Ans. Object -oriented programming is a programming concept where we first create an object then we define the characteristics or functions of an object in the form of data known as fields and methods.
examples of OOP programming are java,c++,python,VB.net and ruby.
simula was the first oop language.
2.Difference between Abstraction and Encapsulation :-
Four important concepts or principles in Java are
Data encapsulation
Data abstraction
Inheritance
Polymorphism
Abstraction
|
Encapsulation
|
1. Abstraction solves the problem in the design level.
|
1. Encapsulation solves the problem in the implementation level.
|
2. Abstraction is used for hiding the unwanted data and giving relevant data.
|
2. Encapsulation means hiding the code and data into a single unit to protect the data from outside world.
|
3. Abstraction lets you focus on what the object does instead of how it does it
|
3. Encapsulation means hiding the internal details or mechanics of how an object does something.
|
4. Abstraction– Outer layout, used in terms of design.
For Example:-
Outer Look of a Mobile Phone, like it has a display screen and keypad buttons to dial a number.
|
4. Encapsulation– Inner layout, used in terms of implementation.
For Example:- Inner Implementation detail of a Mobile Phone, how keypad button and Display Screen are connect with each other using circuits.
|
3.What is the difference between JVM, JDK, JRE & OpenJDK?
*.java
files to obtain *.class
files that contain the bytecodes understandable by the JVM. It’s also the entity that allows Java to be a “portable language” (write once, run anywhere). Indeed there are specific implementations of the JVM for different systems (Windows, Linux, MacOS, see the wikipedia list..), the aim is that with the same bytecodes they all give the same results.4.what is byte code?
Ans. A byte code is an encrypted binary representation of java program when it is compiled.
5.Why java is called compiler -interprter language?
Ans.Java is both Compiled and interpreted Language. Therefore Executing a java program is two stage process:
1) Compiling a source file(.java) and create byte code file(.class)
2) Interpreting byte code(.class) file and create binary code(.exe)file
See the diagram:
i) Java program is converted into byte code file by java compiler(javac)
ii) JVM converts byte code file into binary code (.exe) file i.e. instructions which can be understood by operating system and hardware directly.
This two stage process makes java platform independent as java files are not directly converted to executable files instead they are converted to byte code file which can be used on any platform.
For more features refer following link:
http://java.meritcampus.c
6.Java Command Line Arguments
Simple example of command-line argument in java
In this example, we are receiving only one argument and printing it. To run this java program, you must pass at least one argument from the command prompt. |
Output: Your first argument is: sonoo
Example of command-line argument that prints all the values
In this example, we are printing all the arguments passed from the command-line. For this purpose, we have traversed the array using for loop. |
Output: sonoo
jaiswal
1
3
abc