Java Language : Exploring the Foundations of Programming

 JAVA-

Java Language : Exploring the Foundations of Programming


 Designed by- James Gosling.
 Developer  - Sun Microsysteams.
 First appeared -23/05/1995
 File name extensions - .java,.class,.jar. 

      The basic creation behind java language to make a portable simple as well as secure and safe programming language. java is platform independent. the main use of java is for application programming it is commonly used in window,web based,enterprise and mobile applications. 

       java not support multiple inheritance with the help of class. it can be achieved with the help of interfaces in java. java has automatic garbage collection. java provides a system for developing application software and deploying it in a cross platform computing environment.

FEATURES OF JAVA


  1.   SIMPLE                                                                                                       
  2.   OBJECT ORIENTED                                                                              
  3.    MULTITHREADED                                                                              
  4.    HIGH PERFORMANCE                                                                                
  5.    INTERPRETED                                                                                                 
  6.    PORTABLE                                                                                              
  7.    SECURE                                                                                              
  8.    DYNAMIC                                                                                                    
  9.    PLATFORM INDEPENDENT                                                             
  10.    ROBUST     

java versions -


      VERSION     CODE NAME       RELEASE DATE


  • JDK 1.1.4          Sparkler               Sept 12, 1997                       
  • JDK 1.1.5          Pumpkin               Dec 3, 1997                        
  • JDK 1.1.6            Abigail               April 24, 1998                      
  • JDK 1.1.7            Brutus                Sept 28, 1998                      
  • JDK 1.1.8           Chelsea                 April 8, 1999                      
  • J2SE 1.2        Playgroun             Dec 4, 1998                          
  • J2SE 1.2.1              -                     March 30, 1999                  
  • J2SE 1.2.2           Cricket                 July 8, 1999                     
  • J2SE 1.3         Kestrel                   May 8, 2000                         
  • J2SE 1.3.1          Ladybird                  May 17, 2001                  
  • J2SE 1.4.0       Merlin                   Feb 13, 2002                       
  • J2SE 1.4.1         Hopper                    Sept 16, 2002            
  • J2SE 1.4.2         Mantis                   June 26, 2003                      
  • J2SE 5.0 (1.5.0)Tiger                   Sept 29, 2004                  
  • Java SE 6 RELEASE DATE- December 2006                         
  • Java SE 7 RELEASE DATE- July 2011                                              
  • Java SE 8 (LTS)  RELEASE DATE- March 2014                           
  • Java SE 9 RELEASE DATE- September 2017                         
  • Java SE 10 RELEASE DATE- March 2018                                          
  • Java SE 11 (LTS) RELEASE DATE- September 2018               
  • Java SE 12 RELEASE DATE- March 2019                         
  • Java SE 13 RELEASE DATE- September 2019                        
  • Java SE 14 RELEASE DATE- March 2020                                    
  • Java SE 15 RELEASE DATE- September 2020    




Java Compilers -                                                                     


  • Edison Design Group                                                                 
  • gcj                                                                                              
  • javac                                                                                          
  • javac OpenJDK                                                                            
  • ECJ (Eclipse Compiler for Java)                                                  
  • Power J                                                                                        
  • Jikes           

Basic java programs

Q1)write a java program to print hello world.

-->

class Print
{
public static void main(String ar[])

{
System.out.println("hello world");
}
}


output - hello world.
----------------------------------------------

Q2) write a java program to find factorial of a number.

-->

class Fact
{
public static void main(String ar[])
{
int i, fact=1;
int number=5;
for(i=1;i<=number,i++)
{
fact=fact*i;
}
System.out.println("factorial number is"+fact);
}
}

output - fact number is 120
---------------------------------------------------------------------------------

Q3) write a java program addition of two number using command line argument.

-->

class Demo
{
public static void main(String ar[])
{
int a=2,b=3,c;
c=a+b;
system.out.println("addition  is "+c);
}
}

output - addition is 5.
---------------------------------------------------------------

Q4)write a java program swapping of two number using third variable.

-->

class swap
{
public static void main(String ar[])
{
int a=5,b=4,r;
r=a;
a=b;
b=r;
System.out.println("after swapping a="+a);
System.out.println("after swapping b="+b);
}
}
output - after swapping a= 4
             after swapping b= 5

-----------------------------------------------------------------

Q5)write a program in java to find the sum of digit of a given number.

--->

class Digit
{
public static void main(String ar[])
{
int n=123 s=0;
while(n!=0)
{
s=s+n%10;
n=n/10;
}
System.out.println(s);
}
}

output - 6
--------------------------------------------------

Q6)write a java program to print array.

-->
class Demo
{
public static void main(String ar[])
{
int a[]={3,4,5,6,8};
System.out.println("array element are");
for(i=0;i<=4;i++)
{System.out.println(ar[i]);
}
}


output - 3 4 5 6 8
----------------------------------------------------------

Q7)write a java program to display employee information using constructor.
-->

class Emp
{
int id;
string name;
emp(int eid,string nm)
{
id=eid;
name=nm;
}
void show()
{System.out.println("id of employee is"+id);
System.out.println("name of employee is"+name);
}
}
class Demo
{
public static void main(String ar[])
{
emp e=new emp(34,salman);
e.show();
}
output - id of employee is 34.
            name of employee is salman.

Post a Comment

4 Comments