Tag Archives: class
Given: (Exhibit) You want to use the myResource class in a try-with-resources statement. Which change
Given:You want to use the myResource class in a try-with-resources statement. Which change will accomplish this? A. Extend AutoCloseable and override the close method. B. Implement AutoCloseable and override the autoClose method. C. Extend AutoCloseable and override the autoClose method. D. Implement AutoCloseable and override the close method. Correct Answer: D
Given the Person class with age and name along with getter and setter methods, and this code fragment:
Which command line runs the main class com.acme.Main from the module com.example?
Which command line runs the main class com.acme.Main from the module com.example? A. java -classpath com.example.jar -m com.example/com.acme.Main B. java –module-path mods -m com.example/com.acme.Main C. java –module-path mods com.example/com.acme.Main D. java -classpath com.example.jar com.acme.Main Correct Answer: A
Given: (Exhibit) What is known about the Sportscar class?
Given:What is known about the Sportscar class? A. The Sportscar subclass cannot override setTurbo method from the superclass Automobile. B. The Sportscar class is a subclass of Automobile and inherits its methods. C. The Sportscar class inherits the setTurbo method from the superclass Automobile. D. The Sportscar class is a superclass that has more functionality than the Automobile… Read More »
Given: (Exhibit) What is required to make the Foo class thread safe?
Which three statements are true about the structure of a Java class? (Choose three.)
Which three statements are true about the structure of a Java class? (Choose three.) A. A public class must have a main method. B. A method can have the same name as a field. C. A class can have overloaded static methods. D. The methods are mandatory components of a class. E. The fields need not be initialized… Read More »
Given: (Exhibit) executed using this command: java Myclass My Car is red What is the output of this class?
Given: /code/a/Test.java containing: (Exhibit) and /code/b/Best.java containing: package b; public class
Given:/code/a/Test.javacontaining:and/code/b/Best.javacontaining:package b;public class Best { }Which is the valid way to generate bytecode for all classes? A. javac -d /code /code/a/Test.java /code/b/Best.java B. java /code/a/Test.java C. javac -d /code /code/a/Test.java D. javac -d /code /code/a/Test E. java /code/a/Test.java /code/b/Best.java F. java -cp /code a.Test Correct Answer: A
Given: (Exhibit) This class is poorly encapsulated. You need to change the circle class to compute and
Given:This class is poorly encapsulated. You need to change the circle class to compute and return the area instead.What three modifications are necessary to ensure that the class is being properly encapsulated? A. Change the access modifier of the setradius () method to private B. Change the getArea () method public double getArea () { return area; }… Read More »