Histry of Java
Histry of Java
WHAT IS JAVA?
Java is a high-level programing language which are used to co-relate real world
seniors
Java are used to create specific application which are used to resolve real word
problem
Java is a syntactical based language
Java supports OPPS concepts (OOPS=object- oriented programing system)
Java is a highly secured language
It’s run’s different platforms
It is also called also as WORA= writes once’s run anywhere
Java file
Class file
Instructions Java c
----------- JVM
------rules
JRE (java
Coding high level -----rule byte code runtime
Developer Syntax---- - of java mid-level enlivenment)
Java code
CTE CTS
Complier time complier time
error successful cccccc Low level
Output binary level
Writing the set of java instructions in a file it’s also called coding and this is called java file
which is responsible for developer and it is high level programing language and this code is
called as java code. Java code is given to the java compiler (java c) this compiler checks rules
of java and syntax. It gives the code to compiler. Compiler will be checks error or successful
it came error it’s called as CTE compiler time error and it came the successful it’s called as
CTS compiler time successful.java compiler checks the code and it gives successful and java
compiler converted into byte code which is mid-level and this file is called class file.
The byte code is given to JVM (java virtual machines) and JRE (java runtime eniverment)
is necessary requirement in jvm to perform the operations. Byte code converted into jvm.
Jvm will be only understand byte code doesn’t understand java code it means developer
languages. Jvm converted into binary level it is also called low level languages converted
into it gives the output.
HOW TO CREATE JAVA FILE:
Syntax:
class Classname (first class letter is small)
{
Class name
Class name should start with capital letter
Class name should not contain space
Class name should not contain symbol (_ $)
Class name not start with number but it can contain
number
public static void main (String [] args) (string first letter is capital)
{
Here we can do the operation
This place is called main method
}
}
Printing statements:
Printing statements is used to print the require data.
Syntax:-
System. out. println (“data”); (first letter of system is capital)
Write a program a print to your name?
class My_name
{
public static void main(String[] args)
{
System.out.println(“nikhila”);
}
}
TYPES OF VALUES
Number
1. Integers
2. Decimal number
Single c)haracter
1. Alphabets
2. Digits (0-9)
3. Special character
String
1. Group of single character
DATA TYPES Range
1. Boolean = 1bit 0(false) or 1
2. Byte = 2 byte -128 to 127
3. Int = 4byte -2147483648 to 2147483647
4. Short = 2byte -32768 to 32767
5. Long = 8byte -922337203c to 922337203c
(-9.22*10 -18to9.22*1018)
6. Float = 4byte 1.40239846e-45 to 3.40282347e+38f
7. Double = 8byte 4.940656…… to 1.77693134862…
8. Char = 2byte
9. String = no limit
Major data type is Boolean, int, double, char, string,
VARIABLE
Variable is a memory block which is used to store the data
Syntax: -
Data type variable name = data;
Data type and variable name is called variable declaration (reserving the memory)
Variable name and data variable initialization (assigning the value)
Ex: - Boolean A =true;
System.out.println(A);
Ex:-int a =30;
System.out.println(a);
RANGE :-
Class range
{
Public static void main(String[] args)
{
System.out.println(Byte.MIN_VALUE);
System.out.println(Byte.MAX_VALUE);
}
}
IMPORTANT RULE ON DATA TYPES:-
1. Single character values should be written inside the single qoute’s (‘)
2. String values should be written inside the double qoute’s (“)
3. For long data type be ‘L’ should be written at the last.
4. For double data type it is not mandatary ton write ‘D’ at the last.
5. For float data type ‘f’ should be written at the last.
6. Variable names should not be written inside the single quotes or double quotes
7. Decimal values can’t be stored in integer data type
and it developer wants to decimal value by using following steps.
Ex:-
{
Int a = (int)23.89;
System.out.println(a);
} output:- 23
WIDEING COVERSION
Whenever we are assigning smaller data type value to bigger data type variable implicit
type casting is performed. It is also known as widening or upcasting.
{
Byte a = 10;
Short b = 30;
Int c =40;
Long d = a+b+c;
System.out.println(d);
}
Output:-80 it is called wideing
NARROWING CONVERSION
Whenever we are assigning bigger data type value to smaller data type variable then explicit
Type casting is required.