0% found this document useful (0 votes)
123 views

It-404 (T) Feb 16

The document discusses the differences between JDK, JRE, and JVM. It states that JDK contains both JRE and development tools, while JRE only contains runtime libraries and files needed to execute Java code. JVM is an abstract machine that provides the runtime environment to execute Java bytecode. It allows Java to be platform independent by implementing Java virtual machines for different operating systems.

Uploaded by

api-258199385
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
123 views

It-404 (T) Feb 16

The document discusses the differences between JDK, JRE, and JVM. It states that JDK contains both JRE and development tools, while JRE only contains runtime libraries and files needed to execute Java code. JVM is an abstract machine that provides the runtime environment to execute Java bytecode. It allows Java to be platform independent by implementing Java virtual machines for different operating systems.

Uploaded by

api-258199385
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as PDF, TXT or read online on Scribd
You are on page 1/ 4

1. What is difference between JDK, JRE, and JVM?

JDK means java development kit. It contains JRE+ development tools. The JDK is a superset of
the JRE, and contains everything that is in the JRE, plus tools such as the compilers and
debuggers necessary for developing applets and applications.
JRE
Lib
JVM

Devel
opme
nt
tools

Files

Java development tool kit (JDK)

JRE means java runtime environment. It is used to provide runtime environment. The Java
Runtime Environment (JRE) provides the libraries, the Java Virtual Machine, and other file
components to run applets and applications written in the Java programming language. In
addition, two key deployment technologies are part of the JRE:
Java Plug-in: which enables applets to run in a browser.
Java Web Start: which deploys standalone applications over a network.
It is also the foundation for the technologies in the Java 2 Platform, Enterprise Edition (J2EE) for
enterprise software development and deployment. The JRE does not contain tools and utilities
such as compilers or debuggers for developing applets and applications.
JVM means java virtual machine. JVM (Java Virtual Machine) is an abstract machine. It is a
specification that provides runtime environment in which java byte code can be executed. JVM
does not understand the java language. Thats why at the time of compilation of .java file
produces .class files containing the byte codes understandable by the JVM. It's also the entity
that allows Java to be a "portable language" (write once, run anywhere). JVMs are available for
many hardware and software platforms. Indeed there are specific implementations of the JVM
for different systems (Windows, Linux, Mac OS).The aim is that with the same byte codes they all
give the same results.

[email protected] +91-9830-740-684
sohamsironline.weebly.com,
sohamsironline.ucoz.com

The JVM performs following main tasks:

Loads code.
Verifies code.
Executes code.
Provides runtime environment.

2. Why is JAVA consider to be platform independent? And what does platform refer to here?

JAVA is considered to be platform independent because of java virtual machine. . It is a


specification that provides runtime environment in which java byte code can be executed. The
JVM does not understand the java language. Thats why at the time of compilation of .java file to
obtain .class files that contain the byte codes understandable by the JVM. For that it allows Java
to be a "portable language" (WORA or, write once, run anywhere).
Platform is the combination of system software (operating system) & some sort of hardware. The
Java platform is a suite of programs that facilitate developing and running programs written in
the Java programming language. The platform is not specific to any one processor or operating
system rather an execution engine (called a virtual machine) and a compiler with a set of libraries
are implemented for various hardware and operating systems so that Java programs can run
identically on all of them.
3. Is JVM dependent on platform? Justify your answer.

Yes, JVM is platform dependent .


Because it is a specification that provides runtime environment in which java byte codes can be
executed. The JVM does not understand the java language. Thats why a .java file is compiled to
produce .class file(s) that contain the byte codes understandable by the JVM. It's also the entity
that allows Java to be a "portable language" (write once, run anywhere). JVMs are available for
many hardware and software platforms. Indeed there are specific implementations of the JVM
for different systems (Windows, Linux, and Mac OS).
4. Is there any concept of garbage value? Justify your answer with code snippet.

[email protected] +91-9830-740-684
sohamsironline.weebly.com,
sohamsironline.ucoz.com

5. What is the role of the operator + in java?


The role of + operator in java: there are dual role of "+operator in java; as addition operator
and concatenation operator

Example 1:

Example 2:

6. How many types of primitive data available in java & occupy the memory.
There are 8 types of primitive data available in java:
o Numeric: 1. Whole Numbers
2. Fractions
Whole Numbers: byte 1 byte default value 0
short2 bytes default value 0
int 4 bytes default value 0
long 8 bytes default value 0
Fractions: float 4 bytes default value 0.0f
Double 8 bytes default value 0 .0
o Symbolic: char 2 bytes (Sun Unicode Character) default value\u0000
o Logical: boolean 1 byte default value false

7. State the rules of unary & binary operators in java. State with code snippet.

Rule of unary operator:


If the operand is of a type which is less than capacity of the data type int, the output is converted
to int, else the type of the output is the type of the operand.

[email protected] +91-9830-740-684
sohamsironline.weebly.com,
sohamsironline.ucoz.com

Input operator is byte,


byte < int

result must be int and type of y be int or higher

Rule for Binary Operator:


If the Binary operator takes 2 operands one of type T1 and the other of type T2, and max(T1,T2)
is less than (capacity of) or equal to int , then the output is converted to int itself, else the output
is of type max(T1,T2).
The rule is not applicable to increment & decrement operator.
Code-I:

Input operands types are byte and int

Max(byte, int) int


Compilation Error

result will be

int

Type of z must be int or higher

Code-II
Input Operand Types: byte, long
Max(byte, long) long which is > int

Type of z must be long or higher


8. Why is java referred to as a strongly typed language? Justify your answer with code snippet.
9. How does an array in java differ from arrays in c?

10. Can you assign a value to the length of array to change the no. of elements?
11. Write a code snippet containing a function which returns an array.
12. Write a code snippet to demonstrate the concepts of command & arguments.
13. Write a c code equivalent to the above &test if there is any difference between the two.

[email protected] +91-9830-740-684
sohamsironline.weebly.com,
sohamsironline.ucoz.com

You might also like