QUESTION 26 You cannot create an instance from an interface using the new operat
ID: 3582435 • Letter: Q
Question
QUESTION 26
You cannot create an instance from an interface using the new operator.
True
False
1 points
QUESTION 27
An interface as well as a class may have parameterized types.
True
False
1 points
QUESTION 28
The order of components added into a container using Swing's BorderLayout is immaterial.
True
False
1 points
QUESTION 29
The Java compiler automatically will handle checked exceptions; it requires you to write code to handle unchecked exceptions.
True
False
1 points
QUESTION 30
A node may appear only once in a Scene.
True
False
Explanation / Answer
QUESTION 26 : FALSE
No we cant create instance for interface using new, but we can create a instance for interface using anonymous inner class.
Eg: Runnable run = new Runnable() {
public void run() { }
}
QUESTION 27: TRUE
Interface and class can have parameterized types, both allow methods with different parameters. But class allows method definitons and Interface allows abstract methods with parameters. Ofcourse abstract class also contain parametized methods of both abstract and non-abstract types
Eg:
interface interface_name {
public abstract void setMessage(String msg);
}
class class_name {
public void setMessage(String msg) { }
}
QUESTION 28: TRUE
The components added to the BorderLayout in Swings is immaterial, because the components added to different directions will make the container in the Swing become ambigious. For example, if two components added to the same direction, once might replace the other component. Ofcourse, if we create a JPanel of components that can resolve upto some extent.
Eg:
class Home extends JPanel {
public Home() {
Conntainer c = getContentPane();
c.addLayout(new BorderLayout());
}
}
Then add the above component, to Swing, that can resolve immaterialization
QUESTION 29: FALSE
Checked Exceptions are compile time exceptions, and Unchecked exceptions are Runtime exceptions. Unchecked will be automatically thrown by JVM, unlike checked exceptions need exception handlers like try,catch, throw, throws and finally to handle them
Eg 1:
try {
FileReader fr = new FileReader("D:\Hello.txt");
} catch(FileNotFoundException fe) {}
Eg 2:
int x = 50/0; // throws ArithmeticException at runtime
QUESTION 30 :TRUE
A Scene Graph is set of Tree Data Structures. Some of the trees may not be part of scene
A node can contain atmost once to appear in a Scene Graph, because every Scene is swapped in the tree node. Each Node is created from package called javafx.scene.Node
Related Questions
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.