0% found this document useful (0 votes)
15 views2 pages

Java Exam Answers

The document provides an overview of Java, highlighting its main features such as being simple, object-oriented, and platform independent. It contrasts Java with C++, defines key terms like JDK, JRE, and JVM, and explains concepts like bytecode, variables, constants, and type casting. Additionally, it includes syntax examples and the use of Java keywords.

Uploaded by

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

Java Exam Answers

The document provides an overview of Java, highlighting its main features such as being simple, object-oriented, and platform independent. It contrasts Java with C++, defines key terms like JDK, JRE, and JVM, and explains concepts like bytecode, variables, constants, and type casting. Additionally, it includes syntax examples and the use of Java keywords.

Uploaded by

modakmandira7
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

Java Internal Exam – 10 Marks Answers

(Exam Ready)
Unit 1: Introduction to Java

Main features of Java


Java is simple, object-oriented, platform independent, secure, multithreaded, and robust.

Difference between C++ and Java


Aspect C++ Java

Platform Platform dependent Platform independent

Pointers Supports pointers No explicit pointers

Inheritance Multiple inheritance Only through interfaces

Memory Management Manual (delete) Automatic (Garbage


Collection)

Define JDK, JRE, JVM


Term Definition

JDK Java Development Kit – includes tools,


compilers, JRE

JRE Java Runtime Environment – provides


libraries and JVM

JVM Java Virtual Machine – executes bytecode

Bytecode in Java
Intermediate code generated by the compiler, executed by JVM.

Syntax of Hello World Program


class Hello {
public static void main(String[] args) {
[Link]("Hello World");
}
}
Variable and Constant
Term Definition Example

Variable Storage location with int x = 10;


changeable value

Constant Fixed value declared with final double PI = 3.14;


final

== vs .equals()
Operator Use

== Compares reference/address of objects

.equals() Compares contents of objects

Four Java Keywords


Keyword Use

class Define a class

public Access modifier

static Used for class-level methods/variables

final Make constants or prevent inheritance

Type Casting
Converting one data type to another. Example: int a = (int) 3.5;

Method in Java
Block of code executed when invoked. Example: int add(int a, int b) { return a+b; }

You might also like