Core Java - Interview Questions and Answers for 'Public class' | Search Interview Question - javasearch.buggybread.com
Questions
Search
List By Company
List By Topic
Legacy
Tests
Repository
DashBoard
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
Best Of Java
Discussion
Search
Subscribe
Search Interview Questions
More than 3000 questions in repository.
There are more than 900 unanswered questions.
Click here
and help us by providing the answer.
Have a video suggestion.
Click Correct / Improve and please let us know.
Label / Company
Label / Company / Text
Search
Submit Question
Core Java - Interview Questions and Answers for 'Public class' - 1 question(s) found
- Order By Newest
Q1.
What is the difference between public class and class ?
Core Java
Ans. Class without any access specifier has the default scope i.e it can be accessed by any class within same package.
Class declared public can be accessed from anywhere.
Help us improve. Please let us know the company, where you were asked this question
:
Like
Discuss
Correct / Improve
 java   access specifier   access modifiers   public class   class
Correction
Duplicate of Another Question
Company where this question was Asked
Suggestion
Try 1 Question(s) Test
Which access specifiers can be used with top level class ?
public or default
public or private
public or protected
protected or default
Related Questions
Will the static block be executed in the following code ? Why ?
Will static block for Test Class execute in the following code ?
Can a class implement two Interfaces having default method with same name and signature ?
What If we make the method as abstract in another Interface ?
What if we override the conflicting method in the Class ?
Will this code compile ?
What will be the output of following code
public class BuggyBread {
static class A {
A() {
f();
}
public void f() {
System.out.println("A ctor");
}
}
static class B extends A {
B() {
f();
}
public void f() {
System.out.println("B ctor");
}
}
public static void main(String[] args) {
B b = new B();
b.f();
A a = new A();
a.f();
}
}
Upon compiling the following class, What .class files will get created
public class OuterClass{
class InnerClass{
}
}
Make the following class immutable
public class Employee {
private long employeeId;
private String employeeName;
public long getEmployeeId() {
return employeeId;
}
public void setEmployeeId(long employeeId) {
this.employeeId = employeeId;
}
public String getEmployeeName() {
return employeeName;
}
public void setEmployeeName(String employeeName) {
this.employeeName = employeeName;
}
}
Help us and Others Improve. Please let us know the questions asked in any of your previous interview.
Any input from you will be highly appreciated and It will unlock the application for 10 more requests.
Company Name:
Questions Asked: