You are on page 1of 2

1] Write java program to accept emp details like(id,name,salary) from user using Command Line and

display the same.

package assignments;

public class CLI {


public static void main(String[] args) {
int i,sal;
String n;

i=Integer.parseInt(args[0]);
n=args[1];
sal=Integer.parseInt(args[2]);

System.out.println("Details of an employee:");
System.out.println("id:"+i+"\nname: "+n+"\nsalary: "+sal);

2] Difference between Compiler & Interpreter.

Compiler:

i) A compiler translates the entire source code in a single run.

ii) It is faster than an interpreter.

iii) It is more efficient.

iv) Compiler is used in C, C++ languages.


Interpreter:

i) It translate the source code line by line.

ii)It slower than compiler.

iii) It is less efficient.

iv) Interpreter is used in Java.

3] What is the job of JVM & JRE?

JVM:

JVM stands for Java Virtual Machine that is platform dependent.

It converts java byte code into machine language.

JVM is a part of JRE. It cannot be separately downloaded and installed.

To install JVM, you need to install JRE. 

JRE:

JRE stands for Java Runtime Environment responsible for creating environment for code execution.

It is software package that provides Java class libraries, along with JVM and other components.

JRE contains class libraries and other files that JVM requires to run the program.

You might also like