+ All Categories
Home > Documents > JAVA Language1

JAVA Language1

Date post: 06-Apr-2018
Category:
Upload: ahali999
View: 222 times
Download: 0 times
Share this document with a friend

of 15

Transcript
  • 8/3/2019 JAVA Language1

    1/15

    Lecture 1

  • 8/3/2019 JAVA Language1

    2/15

    Benefits of This LanguageJAVA Programs

    The Java Environment

    Installing JAVA Compiling and Running JAVA Program

    Object-Oriented Programming in Java

    JAVA Program

    JAVA Library

  • 8/3/2019 JAVA Language1

    3/15

    ExampleJAVA and Unicode

  • 8/3/2019 JAVA Language1

    4/15

    Machine independent

    Object oriented

    support national character sets

  • 8/3/2019 JAVA Language1

    5/15

    Applets : Programs that are to be embedded in a web

    page

    Java applications:

    console applications

    graphical user interface (GUI)

  • 8/3/2019 JAVA Language1

    6/15

  • 8/3/2019 JAVA Language1

    7/15

    Download SDK and install it Set the PATH and add to it c:\jdk1.5\bin

    Add to CLASSPATH c:\jdk1.5\lib ,

    c:\jdk1.5\jre\lib

  • 8/3/2019 JAVA Language1

    8/15

    Compile:Javac [-classpath .] name.java

    Run

    Java [-classpath .] name of class

    You put your projectin the current

    directory

  • 8/3/2019 JAVA Language1

    9/15

    Anything can be thought of as an object. A class consists of:

    Attributes

    Objects

    Encapsulation

  • 8/3/2019 JAVA Language1

    10/15

    A Java program always consists of one ormore classes.

    You typically put the program code for eachclass in a separate file, and you must giveeach file the same name as that of the classthat is defined within it.

    A Java source file must also have the

    extension .java. Each line command must end with ;

  • 8/3/2019 JAVA Language1

    11/15

    The classes are grouped together into relatedsets that are called packages, and eachpackage is stored in a separate directory.

  • 8/3/2019 JAVA Language1

    12/15

    ExamplesPackage Name Description

    java.lang These classes support the basic language features and the handling of arrays and strings.Classes in this package are always available directly in your programs by default because thispackage is always automatically loaded with your program.

    java.io Classes for data input and output operations.

    java.util This package contains utility classes of various kinds, including classes for managing datawithin collections or groups of data items.

    javax.swing These classes provide easy-to-use and flexible components for building graphical userinterfaces (GUIs). The components in this package are referred to as Swing components.

    java.awt Classes in this package provide the original GUI components (JDK1.1) as well as some basicsupport necessary for Swing components.

    java.awt.geom These classes define 2-dimensional geometric shapes.

    java.awt.event The classes in this package are used in the implementation of windowed application tohandle events in your program. Events are things like moving the mouse, pressing the leftmouse button, or clicking on a menu item.

  • 8/3/2019 JAVA Language1

    13/15

    To add a package to your project:Import packagename ;

  • 8/3/2019 JAVA Language1

    14/15

    Public class test{Public static void main(string args[])

    {

    System.Out.println(my first test);}

    }

  • 8/3/2019 JAVA Language1

    15/15

    Characters are represented in 16 bit ratherthan 8 bit of ASCCI


Recommended