Java Notes

You might also like

Download as txt, pdf, or txt
Download as txt, pdf, or txt
You are on page 1of 3

features of java. 1. simple 2. object orientad 3. compiled & interpetial. 4. platform independence 5. multithreading 6. robust 7. distributed 8.

secure java is a source language. java gives a complete exception handling oriented mechanism. java is case sensitive language. program:class sample { public static void main(string a[]) { system.out.println("welcome"; } } save file in local disk(c) create a file ncs go to run cd\ cd ncs set path=c:\j2sdl1.4.2_04\bin: javac (complier) javac sample.java java sample datatypes in java size integer long 64 int 32 short 16 byte 8 floating points double - 64 float - 32 character char - 16 0 boolean boolean - true/false. type conversion:- from one data type to other data type 1. compatible types 2. larger <- small (automatic type conversion) type casting eg:- int a; byte b=12; a = b; //write a prg to compute the area of the circle. class area range -2,10,7,8,483,648 to 2,147,483,647 -32,768 to 32,767 -128 to 127

to 65,,536 0-127-ascic

{ public static void main(string args[]) { double pi,r,a; r=10.8; pi= 3.1416; a=pi*r*r; system.out.println("area of circle is"+a); } } public static void main(string args[]) -> pvsm(string args[]) system.out.println -> (sop) //write a prg to demostrate the type casting in java class conversion { psvm(string args[]) { byte b; int i=257; double d=323.142; sop("\n conversion of int to byte"); b=(byte)i; sop(" i and b" +i+" "+b); sop("\n conversion of double to int"); i=(int)d; sop("d and i"+d+" "+i") sop("\n conversion of double to byte"); b=(byte)d; sop("d and b" +d+" "+b"); } } output:257 323.142 323 323.142 67 operators:arithmetic +,-,*,/,% relational -,>,<,<=,>= logical && decrement increment - - & + + control structures:selection iteration statement jump statement // prgs to work * * * * write write write write a a a a prg prg prg prg to to to to demostrate the basic arithmetic operations find the largest of 3 numbers. print the 1st ten fibonacci numbers. convert the temperature frahenhit to celsius

* write a prg to produce the conversion table for us dollar and indian rupees * write a prg to print a triangle 0 12 345 6789

You might also like