Presentation is loading. Please wait.

Presentation is loading. Please wait.

 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.

Similar presentations


Presentation on theme: " It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling."— Presentation transcript:

1

2  It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling

3 There are two types of java programming. They are  Application programming  Applet programming

4  Application programming was based on CUI (character user interface)  It has a more security privilege.

5  Applet programming is based on GUI ( graphical user interface )  It is more secure.  It is executed in a java-enabled browser ( such as Internet Explorer, Applet browser)  It can only runs on Applet viewer or any other browser.

6

7 Class Example { public static void main(String arg[]) { System.out.println( “This is a simple java program”); } }

8  Java compiler compiles Java code to an intermediate byte code that is understood by the Java Environment.  JVM – Java Virtual Machine  JVM is an Interpreter.  JRE – Java Runtime Environment

9  Other than data types such as int, float, etc.  There are two other data types such as byte and Boolean.  Java obeys Unicode ( 16 bit character)  Java provides 2 bytes for char & 4 bytes for int.

10  Similar to C++, java also consists of compound statements such as if………else, while statement etc.  It also consists of switch cases, looping statements etc.  But It does not support “ go to “ statement.

11  Java does not support multiple inheritance.  All classes in java are derived from object class.  To inherit from a class, we use the extends Keywords.  The base class is known as Super class in Java.  The derived class is known as Subclass in java.

12  Array is a collection of data of a similar type in a memory location.  Syntax: 1, [ ] ; (or) 2, [ ];

13 A java program can be executed in command prompt by using following steps: 1, Save  welcome.java 2, At command prompt, javac welcome.java for compiling. 3, At command prompt, java welcome to run the program

14 Steps to create a new project: * file  new project * in the new project window, java  java application  next * in the New java application window, project name : ‘enter the name ‘  next * project name  source package  default package (right click)  new  java class. * in the new class window, class name : ‘enter the name ‘  finish.

15 In a java program to get inputs at runtime, the following command can be used. 1. BufferReader d = new BufferReader( new InputStreamReader( System.in)); 2. DataInputStream d = new DataInputStream( Sysem.in); for assigning value, a = Integer.parseInt( d.readline( ) );

16 TThere are several packages in java. IIt is known as a collection of related class into a single unit. WWe can also create our own packages.

17  A package can be declared using the following syntax: package package_name;

18  Packages can be imported by the following Syntax: 1. import.*; 2. import..*;

19  Java. Lang package is an important package which is automatically imported in the java program.  It provides classes according to primitive type (wrapper class)  Some of the wrapper classes are Integer class, Double class  Object class is the super class of all classes in Lang package.

20 OBJECT CLASS NUMERICA L CLASS INTEGER CLASS LONG CLASS FLOAT CLASS DOUBLE CLASS STRING CLASS

21  Java contains function overloading but it does not contain operator overloading.  Java also does not contain pointer, destructors, go to statement.

22  Similar to oops, java also contains constant data member and member functions.  Syntax: final datatype constant_identifier = assigned value;  Eg: final int a = 10;

23  In java several keywords are used.  Some of them are true, false, null – they are reserved words.

24  Converting one data type variable into another data type is called type casting.  Syntax: variable_dt = (datatype) variable;  Eg: int a; byte b; b=(byte) a;

25  System class is an important class in the java.  It contains two streams namely input stream and output streams  The object of the input stream is ‘in’  The object of the output stream is ‘out’

26  All exceptions in the java programming are the objects of the classes in it.  It is dependent on throwable class such as error and exception.  It is similar to exception handling in C++.  A ‘finally’ block will be executed whether the exception is thrown or not  It appears at the end of the try block

27  It is just like a class. It has methods and data items.  It is declared with a keyword “interface”  All the methods of interface are default abstract method.

28  We can’t inherit an interface into a class but we can implement into a class using “implements” keyword  While implementing, we must define all the abstract methods of the interface into that class.  We can implement more than one class into a single class ( instead of multiple inheritance)

29  Abstract methods have only the declaration. It should be declared/defined in the inherited classes  We cannot create objects for the abstract class but we can create a reference variable.

30

31  Applet does not contain main but contain class which contains following functions.  public void init( );  public void start( );  public void paint( graphics g);  public void stop( );  public void destroy( );

32  Called when applet is first loaded to the browser  It is not called each time the applet is executed.

33  Called immediately after init( ) initialized.  It is revoked each time user returns to page after having left it.  It is used to start animation threads

34  It is called by the browser after init and start  It will revoked whenever the browser redraws the screen ( typically when part of the screen has been obscured and then re-exposed )  This method is used where user level drawing is placed

35 IIt is called when the user leaves the page IIt is used to stop animation threads

36  Import java. Applet.*;  Import java.awt.*; where awt  abstracted window tool kit

37

38


Download ppt " It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling."

Similar presentations


Ads by Google