Core Java - Interview Questions and Answers for 'Public class' | Search Interview Question -

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


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

Try 1 Question(s) Test

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() {

      public void f() {
         System.out.println("A ctor");

   static class B extends A {
      B() {

      public void f() {
         System.out.println("B ctor");

   public static void main(String[] args) {
      B b = new B();
      A a = new A();
 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: