True/false game Flashcards
2Next is a legal identifier.
False
Non static methods can access static as well as non static methods of a class.
True
do is a keyword so do() is not a valid method name.
True
A class having no abstract method can’t still be abstract. But not vice-versa.
False
A class having no abstract method can still be abstract. But not vice-versa.
True
final static public void main (String[ ] arguments ) { } is valid.
True
InputException and MemoryException are valid exceptions in Java
False
FileNotFoundException and SecurityException are valid exceptions in Java
True
If a.equals(b) returns true, b instanceof ClassOfA must always be true.
False
The array consumes less memory than the ArrayList
True
Accessing an element in an array is faster than in ArrayList.
True
arrays implements Collection Interface
False
Accessing implements Collection Interface
True
A “default” constructor calls the no-args constructor of the super class.
True
float f = -123; is valid
True
It is not possible to create arrays of length zero
False
A static method can’t access non-static instance variables of a class.
True
StringBuilder sb1 = new StringBuilder() will create a StringBuilder object with no characters, but with an initial capacity to store 16 chars.
True
StringBuilder sb1 = new StringBuilder(5*10) will create a StringBuilder object with a value 50.
False
The insert method can be used to insert a character, number, or String at the start or end or a specified position of a StringBuilder.
True
A class can’t define multiple main methods.
True
More than one class in an application can define the main method.
True
The main method may accept a String, a String array, or varargs (String… arg) as a method argument.
False
The main method shouldn’t define an object of the class in which the main method itself is defined.
False
The following is valid: static import java.lang.System.*;
False
A variable can be synchronized
False
A local variable can be volatile
False
A constructor can be final
False
A local variable can be transient
False
Only member variables can be volatile
True
Only member variables can be transient
True
A constructor can be static
False
A constructor can be abstract
False
ArrayList extends java.util.AbstractList
True
System.gc() suggests JVM to do garbage collection
True
Static methods are not overridden, but shadowed
True
strictfp is a keyword in java
True
do is a keyword in java
True
unsigned is a keyword in java
False
A short can be assigned to a char without casting
False
We cannot use this/super in static methods
True
The variables of an interface are public, final and static
True
The methods of an interface are public and abstract
True
The methods of an interface can be final
False
The methods of an interface can be static
False
A derived class is abstract if it doesn’t implement all the abstract methods of it’s based class
True
length() is a method of the Array class
False
length() is a method of the String class
True
StringBuilder has a method concat()
False