Literature Notes
Test Prep
Study Guides
Log In
Sign Up
Home
Questions and Answers Archive
Java Programming
January 2022
Java Programming questions and answers in January 2022
Using the Java snippet below, what object-oriented principle (s) are being applied here? inheritance + polymorphism (method overriding) public interface Y { O encapsulation only public void start( ); ...
Match all the parts of this method signature in Java: O protected = class scope declaration static = access modifier protected static String findName(long id) {} String = method parameter id = return ...
Using the Java snippet below, where can z be accessed from? only A public class Test { O A, B, and D int x; O only C public Test( ) { 1/ A O A, B, C, and D public int dostuff( ) { Clear Next int y; 1/...
Predict the output of this Java code snippet true; one; three O false; one; three boolean a = true; boolean b = !a; O false; two; three System . out . printIn(b) ; if (a && b) { O false; two; ...
Predict the output of this Java code snippet O 2 int [ ] nums = {2, 9, 1, 5, 8, 3, 2} ; int x = 0; 0 4 for (int i = 0; i < nums . length; i++) { 0 5 if ( nums [i] != 8) { continue; O 3 } else if (n...
Predict the output of this Java code snippet O 2 int [ ] nums = {1, 2, 3, 4, 5, 6} ; 0 3 int sum = 0; int x = 0; 0 6 while (x < 3) { sum += nums [x]; O 21 x+ +; Clear Next System . out . printIn (s...
Why does this Java code not print "hello world"? The String constructor is not used String h = "hello"; The print statement is not correct h . concat (" world"); String d...
In the Java code below, how could you change it to make it print "bar" instead? Change the order of the names in the array String[ ] names = {"Andrew", "Bob"} Add another...
Predict the output of this Java code snippet It prints "bar" because the first name is "Andrew" String[ ] names = {"Andrew", "Bob" } O It prints "foo"...
Previous
1
Next