What happen when you compile and run following code:(Choose three correct option) public class R4R { public static void main(String args[]) { for(int i = 5; i > 3; i--) { for(int j = 3; j<= 5; j++) { if(i == j) break; System.out.println(" Value of i = " + i + " Value of j = "+j); } } } } ,Java, C ,C++, ASP, ASP.net C# ,Struts ,Questions & Answer, Struts2, Ajax, Hibernate, Swing ,JSP , Servlet, J2EE ,Core Java ,Stping, VC++, HTML, DHTML, JAVASCRIPT, VB ,CSS, interview ,questions, and answers, for,experienced, and fresher
What happen when you compile and run following code:(Choose three correct option)
public class R4R
{
	public static void main(String args[]) 
	{
		for(int i = 5; i > 3; i--) 
		{
			for(int j = 3; j<= 5; 

j++) 
			{
			if(i == j) break;
			System.out.println(" Value of i = " + 

i + " Value of j = "+j);
			}
		}
	}
}

More interview questions and answers

Which are the unused reserved keyword in JAVA?

which are the identifiers in JAVA?

Which primitive type are best to represent the population of the Earth?

Which premitive type is best to represent amount of money(saving for retirement) in terms of dollar and cents.

Output of the following code will be: class test { public static void main(String args[]) { int i=9,j=1; do { if(i-->j++) { continue; } }while(i>2); System.out.println("i= " +i+ " and j= " +j); } }

Output of the following code will be: class Test { public static void main(String args[]) { int i = 12,j = 3; do { if(iOutput of the following code will be: class Test { public static void main(String args[]) { int i = 2, j = 4; if (i = j) { System.out.println("i = " + i); } else { System.out.println("j = " + j); } } }

public class Test { static boolean XYZ(char a) { System.out.print(a); return true; } public static void main(String args[]) { int i=0; for(XYZ(\'P\'); XYZ(\'Q\')&&(i<2); XYZ(\'R\')) { i++; XYZ(\'S\'); } } }

Output of the following code will be: public class Test { static boolean XYZ(char a) { System.out.print(a); return true; } public static void main(String args[]) { int i=0; for(XYZ('P'); XYZ('Q')&&(i<2); XYZ('R')) { i++; XYZ('S'); } } }

Output of the following code will be: public class Array { public static void main(String args[]) { int a1[], a2[]; a1 = new int[20]; a2 = a1; System.out.println(" a2[1] = " + a2[0]); } }

What is primitives?

What is private members?

What is public access?

What is public members?

What is Reference variable?

What is Runtime exceptions?

What are shift operators?

What are SortedMap interface?

What is Source file?

What is stack trace?

What is static nested classes?

What is static methods?

What is static variable?

What is string literal?

What is String objects?

What is super class?

What is switch statement?

What is Synchronized methods?

What do think about Thread?

What is Time-slicing?

What is transient variables?

What is variable access?

What is Visibility?

What happen when you compile and run following code: public class ABC { static float x; public static void main (String args[]) { System.out.println("Value of x is " + x); } }

What is right to way to declare array of primitives?

What happen when you compile and run following code: public class R4R { public static void main(String [] args) { signed int i = 7; for (int y=1; y<6; y++, x--) System.out.print(" Value of x will be " + x); } }

Which list has correct set of Java reserved keywords?

Which two are the valid string declaration?

Choose two options which is valid declaration of boolean?

Choose two options which are valid declaration in case of float?

What happen when you compile and run following code:(Choose three correct option) public class R4R { public static void main(String args[]) { for(int i = 5; i > 3; i--) { for(int j = 3; j<= 5; j++) { if(i == j) break; System.out.println(" Value of i = " + i + " Value of j = "+j); } } } }

How much bits and bytes are used by double primitive in Java?

Constructor of any class doesn't have any return type.

What happen when we compile and run following code: public class R4RSCJPtest { public static void main(String args[]) { int i,j=1; for(j=1;j<4;j++) { i = ((j>0) && (j<2))?2:1; switch(i) { case 0: System.out.print(0); break; case 1: System.out.print(1); break; case 2: System.out.print(2); case 3: System.out.print(3); break; case 4: System.out.print(4); break; } j++; } } }

Which are the legal array declarations?Choose three correct answer.

Which one is the correct range of long in Java?

What happen when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { int i = 0; do { i++; } while (i < 3); System.out.println("Value of i is " +i); } }

What happen when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { int i=2, j=0; do { i=--i; j++; }while(j<2||i>0); i--; System.out.println(" Value of i is "+i); } }

How you can clean or delete workspace using Ant?

How we can set compile target using Ant? Or How we can compile source using ant?

How we can create a jar using Ant?

How we can run jar using ant?

How you can compile, jar and run into ant command prompt?

What is dependency? How it is used into ant? What is its use?

How you can explain ant property?

How we can echo message in Ant?

How many ways we can set properties into build ant file?

What is Built-in Properties? And how many Built-in Properties?Explain main.

How we can set path PATH and CLASSPATH into an ant build file?

Is Java interpreter used for the execution of the byte code?

In Java Programming when file is sucessfully compiled than class extension file is created.

If there are three classes in your Java file than number of class file will be.

Which declarations are essential for every Java application?

Give us two parts(in proper sequence) in executing a Java Program and their purposes?

What are the three OOPS Principle in Java Programing?

What happen we compile and execute following code: System.out.println("// Looks like a comment.");

In order for a source code file, containing the public class Test, to successfully compile, which of the following must be true?

What is return type of main() method in Java Program?

What is the argument type of main() method in Java Program?

Which type of comments are used in Java Programing?

Java supports multidimensional arrays.

Strings are instances of class String?

What is the value of a[3] as the result of the following array declaration?

Choose correct primitive type in Java?

Select two correct declaration and initialization(with four elements) of an array?

When happen when compile and run following code: public class R4RSCJPTest { public static void main(String [] args) { Test [][] ABC = new Test[2][]; System.out.println(ABC[1][0].toString()); } } class Test {}

Select two correct options from the followings.

Class, Method, and Variable Modifiers

Flow Control

Error Handling

Package Control

Primitives

Variable Keywords

void Return Type Keyword

Select three correct options than comes when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { int i=1, j=1; try { i++; j--; if(i/j > 1) i++; } catch(ArithmeticException e) { System.out.println(0); } catch(ArrayIndexOutOfBoundsException e) { System.out.println(1); } catch(Exception e) { System.out.println(2); } finally { System.out.println(3); } System.out.println(4); } }

Select correct options that comes when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { int i=2, j=1; try { i--; j++; if(i != j) i--; } catch(ArithmeticException e) { System.out.println(0); } catch(ArrayIndexOutOfBoundsException e) { System.out.println(1); } catch(Exception e) { System.out.println(2); } finally { System.out.println(3); } System.out.println(4); } }

What happen when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { String str1 = "xyz"; String str2 = new String("xyz"); if(str1 == str2) System.out.println(0); else System.out.println(1); if(str1.equals(str2)) System.out.println(2); else System.out.println(3); } }

What result comes when compile and run following code: public class Test { public static void main(String args[]) { String str1 = "xyz"; String str2 = "xyz"; if(str1 == str2) System.out.println(0); else System.out.println(1); if(str1.equals(str2)) System.out.println(2); else System.out.println(3); } }

What result comes when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { int i = 2; do { i++; }while (i > 2); System.out.println(i); } }

In the following method at what stage does the object initially referenced by s becomes available for garbage collection? void method abc() { String str1 = new String("xyz"); String str2 = new String("xyz"); str1 = str1+1; //1 str1 = null; //2 str2 = str2 + str1; //3 } //4

From the following statement select two correct options.

Select two options which are correct in case of interface.

What result comes when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { int i; float f = 2.4f; i = ((int)Math.ceil(f)) * ((int) Math.floor(f)); System.out.println(i); } }

What result come when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { int i; float f = 1.7f; double d1 = 2.7; double d2 = 2.4; i = ((int)Math.ceil(f)) * ((int)Math.round(d1)) * ((int)Math.round(d2)); System.out.println(i); } }

Which of these classes are defined in java.io and used for file handling are abstract.

What result comes when we compile and run following code: public class R4RSCJPTest { public static void main(String args[]) { String str1="abcd"; String str2="efgh"; String str3=str1.concat(str2); str1.concat(str2); System.out.println(str1); } }

What result comes when we compile and run following code: public class Test { public static void main(String args[]) { String str1="abcd"; String str2="efgh"; String str3=str1.concat(str2); str1 = str1.concat(str2); System.out.println(str1); } }

What result comes when we compile and run following code: public class Test { public static void main(String args[]) { String str1="abcd"; String str2="efgh"; String str3=str1.concat(str2); str1 = str1.concat(str2); System.out.println(str1); } }

What result comes when we compile and run following code: public class Test { public static void main(String args[]) { String str1="abcd"; String str2="efgh"; String str3=str1.concat(str2); str1 = str1.concat(str2); System.out.println(str1); } }

Literals and Ranges of All Primitive Data Types

R4R provides free online tutolrails ,examples for Freshers and experts .We cover core java, tutorials, spring, Hibernate, python, struts, struts 2,c language, spring boot,PHP,MYSQL,C#,ASP.NET,WPF,WCF,Photoshop , JSP, programming, example, Interview questions and answer