programming languages Online Quiz - 194
Description: programming languages Online Quiz - 194 | |
Number of Questions: 20 | |
Created by: Aliensbrain Bot | |
Tags: programming languages |
finalize method is used to release system resources.
Constructors can have a return type.
Any class that implements the Runnable interface has to provide the implementation for the following methods public void start(); public void run();
A thread that has called the wait() method of an object still owns the lock of the object.
If you call the interrupted() method of a thread object twice the second call will always return false.
class Line { Line 1. public class Point { public int x,y; } Line 2. public Point getPoint() { return new Point(); } Line 3. } Line 4. class Triangle { Line 5. public Triangle() { Line 6. // insert code here Line 7. } 18. } Which code, inserted at line Line 6, correctly retrieves a local instance of a Point object? A. Point p = Line.getPoint(); B. Line.Point p = Line.getPoint(); C. Point p = (new Line()).getPoint(); D. Line.Point p = (new Line()).getPoint();
public class test { Line 1. public static void main(String [] a) { Line 2. assert a.length == 1; Line 3. } Line 4. } Which two will produce an AssertionError? (Choose two.) A. java test B. java -ea test C. java test file1 D. java -ea test file1 E. java -ea test file1 file2 F. java -ea:test test file1
Given a method that must ensue that its parameter is not null: Line 1. public void someMethod(Object value) { Line 2. // check for null value Line 3. System.out.println(value.getClass()); Line 4. } What, inserted at line 2, is the appropriate way to handle a null value? A. assert value == null; B. assert value !null, “value is null”; C. if (value == null) { throw new AssertionException(”value is null”); D. if (value == null) { throw new IllegalArgumentException(”value is null”);