JAVA-INTERVIEW
JAVA-INTERVIEW
Home
Interview Questions
Recruitment Process
Resume Writing
Career Advice
Syllabus
SIGN IN
your password
PASSWORD RECOVERY
Recover your password
your email
Interview Questions
Interview Question of Java: Most Asked Questions
In Interview Set: 1
By
Cyber Tecz
24697
An object consists of methods and classes that depict its state and perform
operations. A Java program contains a lot of objects instructing each other their
jobs. This concept is part of core Java.
Java encapsulates codes in various classes that define new data types. These
new data types are used to create objects.
When a Java program contains more than one method with the same name but
with different properties, then it is called method overloading.
Overloading refers to the case of having two methods of the same name but
different properties whereas, overriding occurs when there are two methods of
the same name and properties, but one is in the child class and the other is in
the parent class.
In Java, access specifiers are the keywords used before a class name
which defines the access scope. The types of access specifiers for
classes are:
Public: Class,Method,Field is accessible from anywhere.
Protected: Method,Field can be accessed from the same class to
which they belong or from the sub-classes,and from the class of same
package,but not from outside.
Default: Method,Field,class can be accessed only from the same
package and not from outside of it’s native package.
Private: Method,Field can be accessed from the same class to which
they belong.
A singleton class in java can have only one instance and hence all its methods
and variables belong to just one instance. Singleton class concept is useful for
the situations when there is a need to limit the number of objects for a class.
Constructor gets invoked when a new object is created. Every class has a
constructor. If we do not explicitly write a constructor for a class the java
compiler builds a default constructor for that class. This is Important Interview
Question of Java
In java, main method must be public static in order to run any application
correctly. If main method is declared as private, developer won’t get any
compilation error however, it will not get executed and will give a run time error.
14. How an object is serialized in Java?
Yes, a class can have multiple constructors with different parameters. Which
constructor gets used for object creation depends on the arguments passed
while creating the objects.
We cannot override static methods. Static methods belong to a class and not to
individual objects and are resolved at the time of compilation (not at
runtime).Even if we try to override static method,we will not get an complitaion
error,nor the impact of overriding when running the code.
String is not a primitive data type in java. When a string is created in java, it’s
actually an object of Java.Lang.String class that gets created. After creation of
this string object, all built-in methods of String class can be used on the string
object.
An array groups data of same primitive type and is static in nature while vectors
are dynamic in nature and can hold data of different data types.
In java, when an object is not referenced any more, garbage collection takes
place and the object is destroyed automatically. For automatic garbage
collection java calls either System.gc() method or Runtime.gc() method.
If a method does not handle a checked exception, the method must declare it
using the throws keyword. The throws keyword appears at the end of a
method’s signature.
25. What is Polymorphism?
If You Want To Get More Daily Such Interview Questions Updates Then
Press Red Bell Icon At The Right Side of Page To Subscribe our
Updates.
Join Whatsapp Group of Daily Jobs Updates for 2010-2020 Batch: Click
Here
Also Read: Daily Morning Skin Care For Glowing Skin: Click here
TAGS
Java Questions
Cyber Tecz
Our Vision is To Provide Latest Off Campus Placement Papers, Interview Questions,
Resume Writing Tips, Exam Pattern With Syllabus, Career Advice And Many More With
Latest Jobs Information.
Interview Questions
Interview Questions
Salesforce Admin Interview Questions | Most Asked Questions
For Interview
Interview Questions
LEAVE A REPLY
Save my name, email, and website in this browser for the next time I comment.
- Advertisement -
EDITOR PICKS
Tech Service Providers are Hiring Fewer People in Cloud, Data Analytics...
September 16, 2020
POPULAR CATEGORY
Career Advice81
Interview Questions27
Recruitment Process11
Syllabus6
Resume Writing5
ABOUT US
Welcome To The Most Amazing Web For Your Career Guidance. Here You Will Get Useful
Stuffs About Interview Questions, Recruitment Process & Pattern, Career Advice,
Resume Writing, Recruitment Syllabus and Many More
FOLLOW US
Terms & Conditions