Advertisement
Advertisement
Java Quizzes, Questions & Answers
Recent Java Quizzes
Questions: 10 | Attempts: 253 | Last updated: Mar 21, 2025
-
Sample QuestionWhat order are you using in sorting from the highest to the lowest?
Questions: 11 | Attempts: 534 | Last updated: Mar 21, 2025
-
Sample QuestionWrite the value of z after the execution of the following code : int j; int z, j=16; z = (4*j++)/3; Hint: 1)evaluate from Left to Right 2) Prefix(++j) change and use, postfix use and change(j++) 3)Binary operations based on BODMAS rule 4) division, multiplication, and modulus whichever comes first should be performed first. 5) numerator and denominator are integers perform only integer division 151/3 = 50 6) assign the value to z.
Questions: 10 | Attempts: 424 | Last updated: Mar 21, 2025
-
Sample QuestionWhich of these literals can be contained in a data type float variable ?
Questions: 15 | Attempts: 4789 | Last updated: Jul 3, 2025
-
Sample QuestionAll data members in an interface are by default
Questions: 100 | Attempts: 5453 | Last updated: Sep 18, 2025
-
Sample QuestionWhat will be the result of compiling the following program? public class MyClass { long var; public void MyClass(long param) { var = param; } // (Line no 1) public static void main(String[] args) { MyClass a, b; a = new MyClass(); // (Line no 2) } } 1.A compilation error will occur at (Line no 1), since constructors cannot specify a return value 2.A compilation error will occur at (2), since the class does not have a default constructor 3.A compilation error will occur at (Line no 2), since the class does not have a constructor that takes one argument of type int. 4.The program will compile without errors.
Questions: 10 | Attempts: 1012 | Last updated: Mar 22, 2025
-
Sample QuestionWhat of the following is the default value of an instance variable?
Questions: 10 | Attempts: 116 | Last updated: Feb 13, 2025
-
Sample QuestionIn Java, each thread has its own ________, in which it runs?
Questions: 29 | Attempts: 7701 | Last updated: Jul 22, 2025
-
Sample QuestionGive the abbreviation of AWT?
Questions: 10 | Attempts: 544 | Last updated: Mar 22, 2025
-
Sample QuestionGiven the code fragment: int nums1[] = new int[3]; int nums2[] = {1,2,3,4,5}; nums1 = nums2; for (int x : nums1) { System.out.print(x + ": "); } What is the result?
Questions: 5 | Attempts: 215 | Last updated: Mar 22, 2025
-
Sample QuestionGiven the code snippet from a compiled Java source file: public class MyFile{ public static void main(String[] args) { String arg1 = args[1]; String arg2 = args[2]; String arg3 = args[3]; System.out.println("Arg is "+ arg3); } } Which command-line arguments should you pass to the program to obtain the following result? Arg is 2
Advertisement