Choose a topic to test your knowledge and improve your Java skills
Output : public class Test{ public static void main(String args[]){ String str1 = "one";String str2 = "two" ; System.out.println(str1.concat(str2)); } }
The class string belongs to ................. package.
Output : public class Test{ public static void main (String[] args){ String test = "a1b2c3"; String[] tokens = test.split("\d"); for(String s: tokens) system.out.print(s); } }
How many objects will be created? String a = new String("Examveda"); String b = new String("Examveda"); String c = "Examveda"; String d = "Examveda";
How many Constructor String class have?
What will be output? String S1 = "S1 ="+ "123"+"456"; String S2 = "S2 ="+(123+456);
int x = 0, y = 0 , z = 0 ; x = (++x + y-- ) * z++; What will be the value of "x" after execution ?
int ++a = 100 ; System.out.println( ++a ) ; What will be the output of the above fraction of code ?
Output : class Numbers{ public static void main(String args[]){ int a=20, b=10; if((a < b) && (b++ < 25)){ System.out.println("This is any language logic"); } System.out.println(b); } }
Select from among the following character escape code which is not available in Java.
What will be the output? if(1 + 1 + 1 + 1 + 1 == 5){ System.out.print("TRUE"); } else{ System.out.print("FLASE"); }
Which of the following is the correct expression that evaluates to true if the number x is between 1 and 100 or the number is negative?
Output : public class Test { public static void main(String args[]){ int a = 42; double b = 42.25; System.out.print((a)+" "+(b)); } }
Output : public class Test{ public static void main(String... args){int x =5; x *= 3 + 7; System.out.println(x); } }
Output : public class Test{ public static void main(String... args){ int a=5 , b=6, c=7; System.out.println("Value is "+ b + c); System.out.println(a + b + c); System.out.println("String " + (b+c)); }
What will be the return type of a method that not returns any value?
Which of the following options is the best for generating random integer 0 or 1?
What is Math.floor(3.6)?
In which area of memory, the system stores parameters and local variables whenever a method is invoked?
The variables declared in a class for the use of all methods of the class are called
Output : public class Test{ public static void main(String args[]){System.out.println( Math.floor( Math.random( ) ) ) ; } }
Output : class Num { Num(double x ){ System.out.println( x ) ; } } public class Test extends Num {public static void main(String[] args){ Num num = new Num( 2 ) ;} }
The implicit return type of a constructor is
The finalize() method is called just prior to
The main method should be static for the reason
public class Test { } What is the prototype of the default constructor?
public class MyClass{ } For the above class(MyClass) what is the correct way of declaring constructor?
Output : public class Test{public static void main(String[] args){String value = "abc"; changeValue(value); System.out.println(value); }public static void changeValue(String a){a = "xyz"; }}
Which of these is a legal definition of a method named gkindiaonline assuming it throws IOException, and returns void. Also assume that the method does not take any arguments. Select the one correct
Output : public class Test{public static void main(String args[]){int i; for(i = 1; i < 6; i++){if(i > 3) continue ; } System.out.println(i); } }
In java, ............ can only test for equality, where as .......... can evaluate any type of the Boolean expression.
Output : public class Test{public static void main(String args[]){int i = 0, j = 5 ; for( ; (i < 3) && (j++ < 10) ; i++ ){System.out.print(" " + i + " " + j ); }System.out.print(" " + i + " " + j ); }
Output : class Test {public static void main(String args[]){int x=7; if(x==2); // Note the semicolon System.out.println("NumberSeven");System.out.println("NotSeven"); } }
Output : public class Test{public static void main(String args[]){ int i, j; for(i=1, j=0;i<10;i++) j += i; System.out.println(i); } }
Output : public class Test{ public static void main(String[] args){ int x = 3, y = 4; switch(x + 3){ case 6: y = 0; case 7: y = 1; default: y += 1; } } }
How many times will the following code print "Welcome to Gkindiaonline"? int count = 0; do {System.out.println("Welcome to Gkindiaonline"); count++; } while (count < 10);
Choose the correct statement in context of the following program code. public class Test{public static void main(String[] args){double sum = 0; for(double d = 0; d < 10;){d += 0.1; sum += sum + d; }}
Which of the following for loops will be an infinite loop?
Output : public class Test{static public void main(String args[]){ //line 2 int i, j; for(i=0; i<3; i++){for(j=1; j<4; j++){ i%=j; System.out.println(j); } } }
What is the value of a[1] after the following code is executed? int[] a = {0, 2, 4, 1, 3}; for(int i = 0; i < a.length; i++) a[i] = a[(a[i] + 3) % a.length];
Output : public class Test {public static void main(String... args) throws Exception{Integer i = 34; int l = 34;if(i.equals(l)){System.out.println("true"); }else{System.out.println("false"); } } }
Output : public class Test{ public static void main(String args[]){ int i = 1; do{ i--; }while(i > 2); System.out.println(i); }
Output : int i = 10; while(i++ <= 10){ i++; } System.out.print(i);
___________ method cannot be overridden.
Given the following piece of code: public class School{ public abstract double numberOfStudent(); } which of the following statements is true?
Which of the following class definitions defines a legal abstract class?