Day 1 Date :14 May 2012
Today was the first day of my training in core java at RICCS Education Institute, Ludhiana.In the first class we were told about the history and evolution of Java,its basic features.Java was originally called OAK, and was designed for handheld devices and set-top boxes. Java is the programming language which was developed at Sun Microsystems(now Oracle) by a team led by James Gosling. It combines the best features of C and C++ Language. It is also called as truely OOPS language because you must have to create a Class for every program.We were also given the introduction to the Syntax Of Java and We also made the ubiquitious "Hello world" Program . We also learned about Static And Non Static function.
Then we also made following programs:
Swap two numbers with the help of third variable.
Swap two numbers without the help of third variable.
Reverse a no. with 3 digits.
Program to Swap two Numbers with the help of Third Variable.
Class Swap
{
public static void main(String[] args)
{
int a,b,c;
a=10;
b=20;
System.out.print("Values Before Swapping A="+a "B=" +b);
c=a;
a=b;
b=c;
System.out.print("Values After Swapping A="+a "B=" +b);
}
}
Program to Swap two Numbers without the help of Third Variable.
Class Swap2
{
public static void main(String[] args)
{
int a,b;
a=10;
b=20;
System.out.print("Values Before Swapping A="+a "B=" +b);
a=a+b;
b=a-b;
a=a-b;
System.out.print("Values After Swapping A="+a "B=" +b);
}
}
Program to reverse a number
Class Rev
{
public static void main(String[] args)
{
int a,b,no;
no=123;
a=no%10;
no=no%10;
b=no%10;
no=no%10;
no=a*100+b*10+no;
System.out.print("Reverse number is:" +no) ;
}
0 comments:
Post a Comment