Hi javaranchers , please tell the answer of following and why ?
public class
test {
public static void main(
String args[]) {
int i=0, j=2;
do {
i=++i;
j--;
} while(j>0);
System.out.println(i);
}
}
What all gets printed when the following program is compiled and run. Select all correct answers.
0
1
2
The program does not compile because of statement "i=++i;"
*****************************************************************
If a base class has a method defined as void method() { }
Which of the following are legal prototypes in a derived class of this class. Select all correct answers.
void method() { }
int method() { return 0;}
void method(int i) { }
private void method() { }