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

Java Basics

Uploaded by

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

Java Basics

Uploaded by

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

JAVA

History =>

- initialy developed in 1991 by


James Gosling (Sun MicroSystem)
- old name - OAK(trademark of other co.)
- in 1995 change to JAVA
- in 2010 Oracle acquired Java
- it works on a famous TagLine
WORA(write once run anywhere)

- it has large standard library

JAVA flavour
J2SE - Core-java / Standard Edition/Basic Java
Desktop Application / GUI/ Stand-Alone
J2EE - Advanced java/ Enterprise Edition
Web-based Application
J2ME - Micro-Edition
Android

Differences

JDK JRE JVM

java development java runtime envnt. java virtual machine


kit
have all the software it has all the libraries responsible to
convert the object(byte code) code
tools to create a java app packages into related OS
1. javac(compiler)
2. java(launcher) pre-defined classes
3. javadoc(documentation) methods/function

How the java code compile

source code [sample.java] ----> Compile -----> object code


[Sample.class] // byte code

How the java code run

[ Sample.class ] ------> [ JVM (interpreter)] ----------->


Win/Mac/Linux/ otherOS
{JIT}-->Just In Time Compiler

Features of Java

1. simple
2. portable (platform independent)
3. Robust (strong): - memory management(garbage collector)
4. Secure (becoz of no pointers)
5. Distributed
6. OOPS
7. Multi-threaded

Naming Convention

class : first letter of each word should be capital eg: FirstProgram

variable : camel-case eg: firstName, getDataFromServer


function: camelcase doSomething()
keyword: always in small case(pre-reserved)

Eng Lang Program Lang


alphabet - characters
Words - identifier
sentences - instruction
paragraph - program
chapter - application

java language is case sensitive/

1. characters :
a to z, A to Z, 0-9, %!@#$%^&*( etc.

2. identifiers (all the var, function, class, keywords name)


i. constant (any information is constant here)
int -> -ve/ +ve / 0 -> (56,89,-45, 0)
(real) float -> eg: 89.89, 4.67 , 0.043, 56.0
char 'G', '7', '^', '4';
'ksdjgh' x
'6', '10'x, 'M', '0.1'x, '$', ' 1'x, '3', "h" x , "100"x ,
' '

String : sequence of character enclosed within a double quotes:


eg: "TCIL-IT, Chandigarh", "Hello87980-=-964##@$#"
boolean : true/false

ii. variables

Variables :- variables are the names of the memory block to store


data..
int a = 10;
float marks = 99.56;
char gender = 'M' or 'F';
String name = "TCIL-IT";

a is variable
marks is variable

conditions(rules) for variables:-


1. varible name is the combination of alphabets, number and character
2. can not start with special characters and numbers except _ and $
eg: _name , $abc12, name10
@name(x)
3name(x)
3. spaces are not allowed
String first name (x)
Strnig firstName (ok)
4. can not used keywords as variable name;

iii. Keywords: pre-reserved words( compiler already know their


meaning)
int,float,char, String, boolean,
if, else, else if, for, while, break, continue, switch, class,
public, static, final, abstract etc

You might also like