You are on page 1of 3

Core Java

features of Java Programming language.


simple, object-oriented, portable, platform independant, secured, robust
high performance, multithreaded, distributed, dynamic

public static void main(string args[])


public - Access Modifier, it defines who can access this Method. Public means,
this Method will be accessible by any Class
static - Static is a keyword that identifies the class-related thing
void - It is used to define the Return Type of the Method
main - Main is the name of the Method
string args[] - It is the parameter to the main method. The argument name could be anything

various access specifiers in Java?


access specifiers are the keywords which are used to define the access scope of the method, class, or
a variable.
public, protected, default, private

Package in java?
A package is a collection of similar types of Java entities such as classes, interfaces, subclasses,
exceptions, errors, and enums
Packages are used in Java in order to prevent naming conflicts, to control access, to make searching

What is string in Java?


In Java, string is an object that represents sequence of char values

What is array in Java?


array is an object which contains elements of a similar data type.
The elements of an array are stored in a contiguous memory location.

Class Loaders in java?


it is a subset of jvm. it is responsible of loading class files while java prgm is executed
3 builtin CL- Bootstrap, Extension, S/M / Application

1) What do you think are the advantages of using Java?


Java is a high-level object-oriented programming language
used for developing games, device systems, and applications.
It is secure, fast, reliable, portable and platform independent.

2)What do you understand by Object and Class?


An Object is an instance of a class and it is an real time entity that has state and behavior . For
example, a chair, pen, table, keyboard, bike, etc. It can be physical or logical.
Collection of objects is called class. A class is a blueprint which includes all ur data

3) What are JVM, JDK, and JRE?


• JVM (Java Virtual Machine) it is a runtime environment for codes to be executed.
• JRE (Java Runtime Environment) it is the collection of files needed during runtime by JVM.
• JDK (Java Development Kit) it is needed to write and execute a program
and contains the JRE with necessary development tools.

4) What is meant by looping?


Loops are used to repeatedly execute a certain statement or block of statements.
They are of three types- For Loops, While Loops and Do While Loops.

5. What is the difference between Overloading and Overriding?


When you have two methods of the same name but having different properties is called overloading
Overriding means where two methods with the same name and properties occur in a parent and child
class respectively.

6. What is WORA?
WORA or Write Once Read Anywhere, is the property of a language to run on any platform.
Java is allowed this property due to its bytecode nature.

7. What is the function of ClassLoader?


You can use ClassLoader to load class files before running the java program.

8 What are static methods and static variables?


They are methods and variables shared by all the objects in a class.
Their static nature is a character of the class and not the object itself.

9What do you understand by the Object-Oriented Paradigm?


When your programming paradigm is dependent on objects
containing data with methods defined within the class to which they belong, it is referred to as Object
Oriented Paradigm.

10. Is there a difference between Object Oriented and Object-Based language?


Object Oriented languages such as Java and C++ follow all the concepts of an Object Oriented
Program and do not have inbuilt objects.
Object-Based languages like JavaScript do not follow all OOPs concepts-such as inheritance-

11. What is the function of a constructor?


You can use constructors to initialize the state of any object.
When you create a new object using a new keyword, a default constructor is invoked.
This must have a name similar to the class name.

12. How do you use ‘this’ keyword?


You can use ‘this' to refer to a current object, invoke the current class method or class constructor.
You can also pass it on as an argument into your methods or constructors.

13. What is aggregation?


It is a type of weak relation you can create between two classes,
where one contain references to another class contained within it.

14. What is the purpose of composition?


You can use composition to hold the reference of one class within another class, and in this case,
the contained object cannot exist without the class containing it. It is a type of aggregation.

15. What is annotation?


Annotation is a tag you use to symbolize metadata that represents your class, interface, and fields
among others.
They are used by the compiler and the JVM and don’t directly influence the operations.

16. What is enumeration?


It is an interface you can use to access original data structure from which the enumeration is
obtained.

17. What is the function of Synchronized Block?


While its scope is smaller than method, you can use it to lock an object for each shared resource.

18. OOPS
Object-Oriented Programming is a methodology to design a program using classes and objects
19. Inheritance
When one object acquires all the properties and behaviors of a parent object is known as inheritance.
It provides code reusability.

20. Is it possible to restrict Inheritance?


Yes, it is. You can restrict Inheritance by:
a. Using the final keyword.
b. Making the method final.
c. Using private constructor.
d. Using (//) Javadoc comment

20. Polymorphism
if one task is performed in different ways is known as polymorphism.
example ; A student can learn , write, read, play, dance etc

21) Abstraction
Hiding internal details and showing functionality is known as abstraction.
For example phone call, we don't know the internal processing.

22. Encapsulation
Binding code and data together into a single unit are known as encapsulation.
For example, a capsule, it is wrapped with different medicines.

23. How many types of memory areas are allocated by JVM?


class area, heap, stack, pcr(program counter register), native method stack

You might also like