what will be displayed? 

```

class a {
    int i = 0;
    public int increment() {
        return ++i;
    }
}
 
public class b extends a {
    int i = 10;
    public int increment() {
        return ++i;
    }
 
    public static void main(string[] args) {
        a obj = (a) new b(); 
        system.out.println(obj.increment());
    }
}

```
method a.increment() overlaps in class b.   
 therefore, regardless of the type of the variable obj, will be called the method corresponding to the actual type of the object - that is, b.increment().  
 
this method will use the variable i, declared in the same class b and having an initial value of 10.  
 
the resulting value - 11.
c = input()  

t = len(c)  

temp = ""  

for i in range(0,len(c)):  

    if t<3:  

        break  

    else:  

        if i in (0,1,t-2,t-1):  

            temp = temp+c[i]  

        else:  

            continue  

print(temp) ```
[b]#include[/b] <stdio.h> 

[b]void[/b] [b]foo[/b]([b]int[/b] n)
{
   [b]if[/b] ( n >= 0 )
   {
	  [b]printf[/b]("%d ", n);
	  [b]foo[/b](n - 1);
   }
}

[b]void bar[/b]([b]int[/b] n)
{
   [b]if[/b] ( n >= 0 )
   {
	  [b]bar[/b](n - 1);
	  [b]printf[/b]("%d ", n);
   }
}

[b]int main[/b]() 
{
   [b]int[/b] value = 5;
   [b]foo[/b](value); [b]putchar[/b]('\n');
   [b]bar[/b](value); [b]putchar[/b]('\n');
   [b]return[/b] 0; 
}

/* my output
5 4 3 2 1 0 
0 1 2 3 4 5 
*/
``` The problem is that your pair's closure must return two different types of objects: int if you ask for "con", and the next closure on the line if you ask for "crd".


Here's one possible implementation:


Use a speaker so you can come back.



```
public static Func<string, dynamic> Pair(int x, Func<string, dynamic> y)
{
    Func<string, dynamic> pair =
           (a) =>
           {
               if (a == "con") return x;
               if (a == "crd") return y;
               throw new Exception();
           };

    return pair;
}

public static void Print(Func<string, dynamic> pair)
{
    while (true)
    {
        var next = pair("crd");
        Console.WriteLine((next == null ? "-":"+") +"> " + pair("con"));
        if (next != null)
        {
            Console.WriteLine("|");
            pair = (x) => next(x);
            continue;
        }
        break;
    }
}

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```


  




 (adsbygoogle = window.adsbygoogle || []).push({});
 
  

Test:



```
var pair = Pair(1,
            Pair(2,
                  Pair(3,
                        Pair(4, null))));

Print(pair);

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
```

output:



```
+> 1
|
+> 2
|
+> 3
|
-> 4

        

        
        
        
 (adsbygoogle = window.adsbygoogle || []).push({});
 
        

    
``` > [[cite senthil kumar.p]]
>
> yes this is android studio project.
> 
> both input 1 and input 2 are integers.
> example:
> input1 = 1000
> input2 = 20
> 
> it will create total 50 rows and the order is 
> 0
> 20
> 40
> 60
> etc.....
> 
> 

do you need the codes as below? 
......
for (int i = input1 / input2; i >=0; i--) {
 ......
 t1v.settext("" + i * input2);
 ...... Here, this should do it. I just replaced the

 
```
System.out.println(isPrime(n));

```
 part, which would print true or false, with an if

 
```
if (isPrime(n))
    System.out.println("The number is prime.\n");
else 
    System.out.println("The number is not prime.\n");

```
 Here's the code:

 
```
import java.util.Scanner;
public class PrimeNumber{
    public static void main(String args[]){
        int n;
        Scanner Prime = new Scanner(System.in);
        System.out.println(" Please enter a number: ");
        n = Prime.nextInt();
        if (isPrime(n))
            System.out.println("The number is prime.\n");
        else 
            System.out.println("The number is not prime.\n");
    }

    static boolean isPrime(int n) {
        if (n%2==0)return false;
        for(int i=3;i*i<=n;i+=2) {
            if(n%i==0)
                return false;
        }
        return true;
    }
} 

```
 This is a trivial task. You should probably read your coursebook/tutorials, I bet you'll find the answers there. you can use the repmat function here
if you have to print the patter n (here 10) times, use the following code:
a = [5 4 3 2 1 0]';
n = 10;
b =repmat(a, n,1) %%
var1= [1 1 2 4 5 7 7 7 8 10 11 13 14 14 17 17 17 17 18 20];
var2= [0.5 0.3 0.1 0.6 0.2 0.4 0.8 0.9 0.3 0.2 0.1 0.4 0.8 0.7 0.5 0.9 0.2 0.8 0.3 0.7];

x=min(var1):1:max(var1);
newele1=setdiff(x,var1);
newele2=nan(size(newele1));

newvar1=[var1,newele1];
newvar2=[var2,newele2];

[newvar1,index]=sort(newvar1);
newvar2=newvar2(index) You need to give the user the option of typing in a value that represents that there are no more values to enter. Perhaps give a prompt like:



```
Please enter a value.  Enter -999999 if you have no more values [B]:[/B]
```

As for the ten (or fewer) values, you should probably have an array and a loop instead of ten separate variable names and ten separate cin statements. So you're looking at something like this:



```
double dValue[10];
    int numEntries = 0;
    double sum = 0;
    
    while (numEntries < 10)
    {
          cout << "Enter number (-999999 to stop) : ";
          cin >> dValue[numEntries];
          // check whether dValue[numEntries] == -999999
          // if so, short-circuit the loop with the "break" command
            
          // increment numEntries
          // adjust sum
    }
```

As a side note, I picked -999999 as the value to represent no more values because



1. It's an integer, so it can be represented exactly as a double (no round-off error using == to compare).
2. It's a number that, chances are, people wouldn't actually want to add, so it's sort of "out of the way". Chances are, few people want to add -999999. If they do, they can't use this program! Hi Valdeth. You should use input and output file streams if you want to write and read from a file. Basically you open the file for writing and once you are done close the file. Later you can open the file for reading. The example below reads numbers from the file and just prints them out. If you want to read the file line by line you should look at the getline() function. I have just used your initial array to come up with a result per array which gives the product of all negative numbers in the array. Note that there **HAS** to be at least 1 negative number per array.



```
const int m=4, n=5;
	int i,j;
	int num;
	int result;
	int A[m][n]={{5,3,-4,8,2},
				 {1,5,2,7,-8},
				 {-3,9,5,2,4},
				 {4,-1,3,6,8}};

	ofstream outfile;
	ifstream infile; 

	outfile.open("c:/matrix/matrix.txt");

	for (i=0;i<m;i++)
	{
		result = 1;

		for (j=0;j<n;j++)
		{
			outfile << setw(3)<< A[i][j];

                            // Multiply negative numbers in each array (has to be at least 1 negative number in each array)
			if (A[i][j] < 0)              				                      result *= A[i][j];  // result = result x A[i][j]
		}
		cout << "Result of array " << i << " is " << result << endl;
		outfile << "\n";
	}

	outfile.close(); // Close for writing

	infile.open("c:/matrix/matrix.txt"); // opens the file
    
	infile >> num;
	while ( !infile.eof() ) 
	{ // keep reading until end-of-file
		cout << "The next number is " << num << endl;
		infile >> num; // sets EOF flag if no value found
	}
	infile.close();  //Close for reading
``` let i = `(1)/(sinx*(3 + 2cosx))*dx` = `int sinx/(sin^2x*(3 + 2cosx))*dx` = `int sinx/((1 - cos^2x)(3 + 2cosx))*dx` = `int sinx/((1 - cosx)(1 + cosx)(3 + 2cosx))*dx` put cos x = t∴ – sinx.dx = dt∴ sinx.dx = – dt ∴ i = `int (1)/((1 - t)(1 + t)(3 + 2t))*(-dt)` = `int (-1)/((1 - t)(1 + t)(3 + 2t))*dt` let `(-1)/((1 - t)(1 + t)(3 + 2t)) = "a"/(1 - t) + "b"/(1 + t) + "c"/(3 + 2t)` ∴ – 1 = a(1 + t)(3 + 2t) + b(1 - t)(3 + 2t) + c(1 - t)(1 + t)put 1 – t = 0, i.e. t = 1, we get– 1 = a(2)(5) + b(0)(5) + c(0)(2) ∴ – 1 = 10a ∴ a = `(-1)/(10)`put 1 + t = 0, i.e. t = – 1, we get– 1 = a(0)(1) + b(2)(1) + c(2)(0) ∴ – 1 = 2b ∴ b = `-(1)/(2)` put 3 + 2t = 0, i.e. t = `-(3)/(2)`, we get – 1 = `"a"(-1/2)(0) + "b"(5/2)(0) + "c"(5/2)(-1/2)` ∴ – 1 = `-(5)/(4)"c"` ∴ c = `(4)/(5)` ∴ `(-1)/((1 - t)(1 + t)(3 + 2t)) = (((-1)/(10)))/(1 - t) + ((-1/2))/(1 + t) + ((4/5))/(3 + 2t)` ∴ i = `int [(((-1)/10))/(1 - t) + ((-1/2))/(1 + t) + ((4/5))/(3 + 2t)]*dt` = `-(1)/(10) int 1/(1 - t)*dt - (1)/(2) int 1/(1 + t)*dt + (4)/(5) int 1/(3 + 2t)*dt` = `-(1)/(10) (log|1 - t|)/(-1) - (1)/(2) log | 1 + t| + 4/5 (log|3 + 2t|)/(2) + c` = `(1)/(10)log|1 - cosx| - (1)/(2)log|1 + cosx| + (2)/(5)log|3 + 2cos| + c`.