Java - Online Test - Access specifier - javasearch.buggybread.com
Interview Questions
Search
Legacy
Tests
Repo
Legacy
Java
Java 8
Java 7
Java Abbreviations
OCJP / SCJP
Class List
New in Java 8
Java Exceptions
Spring Exceptions
Java Enums
Java 8 Lambda
Java 8 java.time
Big Data
Discussion Forum
Humor
Classes Search
Subscribe
Search Java Test Questions
223 test questions in repository.
Search
Java - Test Questions on 'access specifier' - 5 questions found
Which access specifiers can be used with top level class ?
Core Java
public or default
public or private
public or protected
protected or default
access specifier
oops
java
class
Overridden methods must have the same ...
Reference
Core Java
name
name and argument list
name, argument list, and return type
name, argument list, return type and belong to the same class
java
overriding
How can we create objects if we make the constructor private ?
Core Java
We can't create objects if constructor is private
We can only create objects if we follow singleton pattern
We can only create one object
We can create new object through static method or static block
constructor
private constructor
Which of the following can be overridden ?
Reference
Core Java
final instance methods
final static methods
non final instance methods
non final static methods
overriding
What will be the output of following code ?
public class BuggyBread {
private int x;
private Integer y;
private BuggyBread(int x,int y){};
public static void main(String[] args){
BuggyBread buggybread = new BuggyBread(1,2);
System.out.println(buggybread.x);
}
}
Core Java
compilation error due to private constructor
compilation error due to uninitialized elements
0 null
0 0
constructor
Please enable JavaScript to view the
comments powered by Disqus.
comments powered by
Disqus