OCP Oracle Certified Professional Java SE 17 Developer Study Guide. Jeanne Boyarsky. Читать онлайн. Newlib. NEWLIB.NET

Автор: Jeanne Boyarsky
Издательство: John Wiley & Sons Limited
Серия:
Жанр произведения: Программы
Год издания: 0
isbn: 9781119864592
Скачать книгу
3 Use a for loop including an enhanced for loop 3 Use a while loop 3 Use a do- while loop 3 Compare and contrast the for, while, and do-while loops 3 Develop code that uses break and continue statements 3 Debugging and Exception Handling Identify syntax and logic errors 1, 2, 3 Use exception handling 11 Handle common exceptions thrown 11 Use try and catch blocks 11 Arrays and ArrayLists Use a one-dimensional array 4 Create and manipulate an ArrayList 9 Traverse the elements of an ArrayList by using iterators and loops including the enhanced for loop 9 Compare an array and an ArrayList 4, 9 Classes and Constructors Create a new class including a main method 1 Use the private modifier 5 Describe the relationship between an object and its members 6 Describe the difference between a class variable, an instance variable, and a local variable 1, 6 Develop code that creates an object's default constructor and modifies the object's fields 6 Use constructors with and without parameters 6 Develop code that overloads constructors 6 Java Methods Describe and create a method 5 Create and use accessor and mutator methods 5 Create overloaded methods 5 Describe a static method and demonstrate its use within a program 5

      Use the following assessment test to gauge your current level of skill in Java for the 1Z0-829. This test is designed to highlight some topics for your strengths and weaknesses so that you know which chapters you might want to read multiple times. Even if you do well on the assessment test, you should still read the book from cover to cover, as the real exams are quite challenging.

      1 What is the result of executing the following code snippet?41: final int score1 = 8, score2 = 3; 42: char myScore = 7; 43: var goal = switch (myScore) { 44: default -> {if(10>score1) yield "unknown";} 45: case score1 -> "great"; 46: case 2, 4, 6 -> "good"; 47: case score2, 0 -> {"bad";} 48: }; 49: System.out.println(goal);unknowngreatgoodbadunknowngreatgoodbadExactly one line needs to be changed for the code to compile.Exactly two lines need to be changed for the code to compile.None of the above

      2 What is the output of the following code snippet?int moon = 9, star = 2 + 2 * 3; float sun = star>10 ? 1 : 3; double jupiter = (sun + moon) - 1.0f; int mars = --moon <= 8 ? 2 : 3; System.out.println(sun+", "+jupiter+", "+mars);1, 11, 23.0, 11.0, 21.0, 11.0, 33.0, 13.0, 33.0f, 12, 2The code does not compile because one of the assignments requires an explicit numeric cast.

      3 Which changes, when made independently, guarantee the following code snippet prints 100 at runtime? (Choose all that apply.)List<Integer> data = new ArrayList<>(); IntStream.range(0,100).parallel().forEach(s -> data.add(s)); System.out.println(data.size());Change data to an instance variable and mark it volatile.Remove parallel() in the stream operation.Change forEach() to forEachOrdered() in the stream operation.Change parallel() to serial() in the stream operation.Wrap the lambda body with a synchronized block.The code snippet will