0% found this document useful (0 votes)
127 views3 pages

Java Programming Theory Notes for Class 12

The document provides comprehensive theory notes for Class 12 Java Programming (IT 802), covering fundamental concepts such as Java features, control statements, arrays, strings, methods, classes, and objects. Key topics include the differences between JVM, JRE, and JDK, as well as OOP principles like encapsulation, inheritance, polymorphism, and abstraction. It also discusses various data types, operators, and control flow mechanisms in Java.

Uploaded by

Pinki Solanki
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)
127 views3 pages

Java Programming Theory Notes for Class 12

The document provides comprehensive theory notes for Class 12 Java Programming (IT 802), covering fundamental concepts such as Java features, control statements, arrays, strings, methods, classes, and objects. Key topics include the differences between JVM, JRE, and JDK, as well as OOP principles like encapsulation, inheritance, polymorphism, and abstraction. It also discusses various data types, operators, and control flow mechanisms in Java.

Uploaded by

Pinki Solanki
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

Class 12 - Java Programming (IT 802) Theory Notes

BASIC QUESTIONS
What is Java?
Java is a high-level, object-oriented, platform-independent programming language developed by
Sun Microsystems.
Write any five features of Java.
Object-Oriented, Platform Independent, Simple & Secure, Robust, Multithreaded.
What is JVM, JRE, and JDK?
JVM executes bytecode, JRE provides runtime environment, JDK includes JRE and tools.
Difference between compiler and interpreter?
Compiler translates whole code, interpreter executes line-by-line.
What is platform independence?
Java code runs on any OS because JVM executes bytecode.
What is bytecode?
Intermediate code executed by JVM; platform independent.
Variables and data types?
Variables store data; data types define the type — primitive and non-primitive.
Primitive vs Non-Primitive types?
Primitive: int, char, boolean. Non-Primitive: String, Array, Class.
Operators in Java?
Arithmetic, Relational, Logical, Assignment, Increment/Decrement, Conditional.
Identifier and Literals?
Identifiers are names, literals are fixed values like 10, 'A', "Java".

CONTROL STATEMENTS
Conditional statements?
Control flow based on conditions: if, if-else, nested if, switch.
if / if-else / nested if
Examples: if(marks>=40), if-else, nested if(marks>=75).
Switch statement syntax
switch(choice){case 1: ... break; default: ...}
Loops
for, while, do-while loops repeat statements.
break vs continue
break exits loop; continue skips iteration.
Entry vs Exit controlled loops
Entry: condition first (for, while); Exit: condition last (do-while).

ARRAYS AND STRINGS


What is an array?
Collection of same data type elements stored contiguously.
Array declaration and initialization
int arr[] = {1,2,3}; or int arr[] = new int[5];
1D vs 2D arrays
1D: single row; 2D: rows and columns.
What is a String?
Sequence of characters enclosed in quotes; object of String class.
String vs StringBuffer
String is immutable; StringBuffer is mutable.
Two methods of String class
length() and toUpperCase()

FUNCTIONS / METHODS
What is a method?
Reusable block of code that performs a specific task.
Call by value vs reference
Value passes copy; reference passes address.
Method overloading
Same name, different parameters.
Use of return statement
Returns value to calling function.
What is recursion?
Method calls itself (e.g., factorial).

CLASSES AND OBJECTS


What is a class?
Blueprint for objects defining variables and methods.
What is an object?
Instance of a class containing real data.
Class vs Object
Class is template; object is instance.
What is a constructor?
Special method initializing objects.
Types of constructors
Default and Parameterized.
Constructor vs Method
Constructor auto-calls, no return; method is explicit, may return.
this keyword
Refers to current object; used to resolve variable conflicts.
static keyword
Used for class-level members, shared among objects.
Encapsulation
Wrapping data and methods, using private access.
Inheritance
One class derives another using 'extends'.
Polymorphism
Same method behaves differently — overloading/overriding.
Abstraction
Hiding implementation using abstract classes/interfaces.
Interface
Collection of abstract methods for multiple inheritance.
Access Modifiers
public, private, protected, default — control visibility.
OOP Principles
Encapsulation, Inheritance, Polymorphism, Abstraction.

You might also like