Lecture notes for Btech CSE
FUNDAMENTALS OF JAVA TECHNOLOGY AND PROGRAMMING
, ● Developed by Greentalk team, initially named as OAK, then green later changed to
Java in
● Found by James gosling at Sun MicroSystems
● Syntax of C/ C++
Java platform features:
● Simple - It’s simple and easy to understand since it follows the same syntax as
C/C++.
● Robust & platform independent - It has strong memory management, exceptional
handling, error handling & automated garbage collection.
● Object oriented programming- It supports objects and classes.
● Portable- Java bytecode can be run into any machine with JVM.
● Multithreaded- Multiple threads can be run in Java concurrently.
● High performance
Java data types:
● Primitive
Boolean Truth value (0 or 1) - 1 bit
Char Character data type- 2 byte
Int Integer data type- 4 byte
Float Point values - 4 byte ( 6 to 7 decimal digits)
Long Same as int, but stores larger values - 8 byte
Double Same as float- up to 15 decimal digits- 8
1
, byte
Short 2 byte
● Non primitive - Array, string.
Java variables:
● Instance - Declared inside a class, but not inside a method.
● Static - With keyword static
● Local - Declared inside a method.
Constants:
Values which cannot be changed which are declared using the “final” keyword.
Scope of variable:
Declares where the variable is visible.
Lifetime of variable:
How long the variable existed before it was destroyed.
● Instance variables
● Local variables
Operators in Java:
Operators in Java can be used to perform operations.
2