noscript

1. What is Java?

Java is a programming language which was developed in 1982, Java is a high-level programming language by James Gosling. Large-scale programs can be developed using it, and it is founded on the ideas of object-oriented programming.

2. Why is Java a platform independent language?

Java compiles the program to create a bytecode or .class file, in contrast to many other programming languages. This file runs independently of any hardware or software, but in order to continue executing the bytecode, the operating system must have a JVM (Java Virtual Machine) file preloaded.

Java is platform agnostic even though the JVM is platform dependent because the bytecode may be written on any system and executed on any other system regardless of the hardware or software being utilized.

3. Why is Java not a pure object oriented language?

Java has 8 primitive data types (byte, short, int, long, char, float, double and boolean) and these are not an object.

4. What are the basic features of Java Programming Language?

Simple, Object Oriented, Potable, Platform Independent, Secured, Robust, Interpreted, Architecture Neutral, High Performance, Multithreaded, Distributed, Dynamic.

5. What do you understand by JVM (Java Virtual Machine)?

The virtual machine known as Java Virtual Machine is what makes it possible for the computer to run Java programs. The Java Virtual Machine (JVM) functions as a run-time engine by invoking the Java code’s main method. The specification that needs to be applied in the computer system is JVM. JVM compiles Java code into machine-independent Bytecode that closely resembles native code.

6. What is the difference between JVM, JRE and JDK?

JVM – The term JVM stands for Java Virtual Machine, an abstract machine that offers the runtime environment needed to execute Java bytecode. The Java Virtual Machine’s operation is outlined in this specification. Oracle and other companies have contributed to its implementation. JRE refers to the way it is implemented.

Because JVMs are available for a wide range of hardware and software platforms, they depend on the platform. It is a runtime instance that is produced during the execution of the Java class. The JVM is made up of three concepts: specification, implementation, and instance.

JRE – For Java Runtime Environment, use JRE. It is the JVM’s implementation. A collection of software tools called the Java Runtime Environment is used to create Java programs. It serves as the runtime environment provider. It is the JVM’s implementation. It is real in the physical sense. It has several files and a collection of libraries that the JVM uses during runtime.

JDK – The abbreviation for Java Development Kit is JDK. It’s a software development environment for creating Java applets and applications. It is real in the physical sense. JRE plus developer tools are included. Any of the Java Platforms listed below, which Oracle Corporation has released, can be implemented using JDK:

Java Platform Standard Edition
Java Platform, Enterprise Edition
Java Platform, Micro Edition

7. What is classloader?

The classloader is a component of the Java Runtime Environment (JRE) that is used for creating or executing bytecode.Java classes and interfaces are dynamically loaded into the Java Virtual Machine (JVM) using the class file classloader. The Java runtime system does not require knowledge of files or file systems because of classloaders.

8. Why pointer does not support in Java?

Java does not support pointer because of,
i. Safety and Security
ii. Automatic Memory Management
iii. Simplicity and Ease of use
iv. Security

9. What do you understand by instance variable and a local variable

Instance Variable :  The variables that are available to all of the class’s methods are known as instance variables. They are declared both inside the class and outside of the methods. These variables characterize an object’s attributes and are inextricably linked to it.

Each object in the class will have a copy of the variables available for use. Only that instance will be impacted by any changes made to these variables; all other class instances will continue to function normally.
Ex. class Person{
int empId;
String empName;
String empAddress;
}

Local Variable : Variables that are exclusively accessible inside of a block, function, or constructor are known as local variables. The variable can only be used inside the block scope. The other class methods are unaware of the local variable whenever it is declared inside a method.
Ex. class  Person{
Public void display(){
int id;
String name;
Int age;
}
}

10. What are the types of memory areas are allocated by JVM?

Class area (Method Area)
Heap
Stack
Program Counter register
Native method stack.

11. What is JIT compiler?

Just In Time Compiler – It’s applied to enhance performance. JIT shortens the compilation time by compiling portions of the bytecode with comparable functionality at the same time. In this context, “compiler” refers to a translator that converts the Java virtual machine’s (JVM) instruction set to the instruction set of a particular CPU.

12. What is the default value of the local variables?

The local variables are not initialized to any default value.

13. What is the use of static variable and methods?

All objects within the class share the static variables and methods. The static belongs to the class, not the object. It is not necessary to build an object in order to access static variables, which are kept in the class area. As a result, static is employed when it’s necessary to declare variables or methods that apply to every class object.

For instance, the college’s name serves as a unifying characteristic for all of the students in the class simulation of a college campus. Consequently, the name of the college will be regarded as static.

14. What are the advantages of packages in Java Programming?

Package definition in Java has several benefits.

i. There are no name conflicts between packages.
ii. More convenient access control is offered by the package.
iii. Classes that are utilized by the package but are concealed from view from the outside can also be had.
iv. Finding the relevant courses is simpler.

15. What is a class?

A class is the collection of Data member and Member function. It is a logical entity, which do not get physical memory allocation without object.

16. What is an object?

The entity existing in real time with a state and behavior is called an Object. When anything is called an object in Java, it’s an instance of a class with methods representing its action and instance variables representing its state. The new keyword can be used to generate a class’s object.

17. What will be the initial value of an object?

All object references are initialized to null in Java.

18. What is constructor?

The unique kind of method used to initialize an object’s state is known as the constructor. When the object’s memory is allocated and the class is instantiated, it is called. Whenever a new keyword is used to create an object, the class’s default constructor is called. The constructor’s name and the class name need to be similar. There cannot be an explicit return type in the constructor.

19. How many types of constructor are used in Java?

There are two type of constructor in Java :
Default constructor/Parameter Less constructor
Parameterized constructor

20. Does constructor return any value?

Yes, you can’t use an explicit return type with the constructor; instead, it implicitly returns the current instance of the class.

 

                                                For more information & classes Call2048553004
                                                               Registration Link: Click Here!

Author: Ambarish Durani

JAVA Trainer

IT Education Centre Placement & Training Institute

© Copyright 2024 | IT Education Centre.