what is java n.
Download
Skip this Video
Loading SlideShow in 5 Seconds..
What is Java? PowerPoint Presentation
Download Presentation
What is Java?

Loading in 2 Seconds...

play fullscreen
1 / 12

What is Java? - PowerPoint PPT Presentation


  • 178 Views
  • Uploaded on

What is Java?. Java technology is both a programming language and a platform ;. Programming Language :. Modern high-level language (Simple, Architecture neutral, Object oriented, Portable, Distributed, High performance, Interpreted, Multithreaded, Robust, Dynamic, Secure).

loader
I am the owner, or an agent authorized to act on behalf of the owner, of the copyrighted work described.
capcha
Download Presentation

What is Java?


An Image/Link below is provided (as is) to download presentation

Download Policy: Content on the Website is provided to you AS IS for your information and personal use and may not be sold / licensed / shared on other websites without getting consent from its author.While downloading, if for some reason you are not able to download a presentation, the publisher may have deleted the file from their server.


- - - - - - - - - - - - - - - - - - - - - - - - - - E N D - - - - - - - - - - - - - - - - - - - - - - - - - -
    Presentation Transcript
    1. What is Java? Java technology is both a programming language and a platform; Programming Language : Modern high-level language (Simple, Architecture neutral, Object oriented, Portable, Distributed, High performance, Interpreted, Multithreaded, Robust, Dynamic, Secure) The Java programming language is unusual in that a program is both compiled and interpreted. Created by Ron Beglieter (based on the Java Tutorial)

    2. Java Programming Lang. “Write once, run anywhere” Generates byteCode Implementation of the Java Virtual Machine (JVM) Spec.

    3. Java Platform The Java platform has two components: • The Java Virtual Machine (Java VM) • The Java Application Programming Interface (Java API)

    4. HelloWorld Application /** * The HelloWorldApp class implements an application that * simply displays "Hello World!" to the standard output. */ class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } }

    5. /** * The HelloWorldApp class implements an application that * simply displays "Hello World!" to the standard output. */ class HelloWorldApp { public static void main(String[] args) { System.out.println("Hello World!"); } } Hello World App. (2) HelloWorldApp.java c:\app> javac HelloWorldApp.java c:\app> dir c:\app> javac HelloWorldApp.java c:\app> dir HelloWorldApp.java HelloWorldApp.class c:\app> javac HelloWorldApp.java c:\app> dir HelloWorldApp.java HelloWorldApp.class c:\app> java HelloWorldApp c:\app> javac HelloWorldApp.java c:\app> dir HelloWorldApp.java HelloWorldApp.class c:\app> java HelloWorldApp Hello World! c:\app> c:\app> javac HelloWorldApp.java c:\app> javac HelloWorldApp.java c:\app> class Robber { … } class Bank { … } Bank.java Robber.java

    6. Object Oriented Concepts What Is an Object? An object is a software bundle of related variables and methods. Software objects are often used to model real-world objects you find in everyday life. What Is a Message? Software objects interact and communicate with each other using messages. What Is a Class? A class is a blueprint or prototype that defines the variables and the methods common to all objects of a certain kind. What Is Inheritance? A class inherits state and behavior from its superclass. Inheritance provides a powerful and natural mechanism for organizing and structuring software programs. What Is an Interface? An interface is a contract in the form of a collection of method and constant declarations. When a class implements an interface, it promises to implement all of the methods declared in that interface.

    7. An Example The following example demonstrates OOP (Object Oriented Programming) key concepts as well as the Java language basics • public class Spot { • public int size; • public int x, y; • public Spot(int intSize) { • size = intSize; • x = -1; • y = -1; • } • } Attributes Constructor

    8. Example (continued) import java.awt.*; import java.awt.event.*; import javax.swing.*; public class ClickMe extends JPanel implements MouseListener { private Spot spot = null; private static final int RADIUS = 7; public void init() { addMouseListener(this); } …. // full code is supplied “same” as #include

    9. Example (continued) public class ClickMe extends JPanel implements MouseListener { … // the missing code is supplied public static void main(String args[]) { ClickMe clicker = new ClickMe(); clicker.init(); JFrame frame = new JFrame(); frame.getContentPane().add(clicker, BorderLayout.CENTER); frame.pack(); frame.setVisible(true); }

    10. Example (continued) public void mousePressed(MouseEvent event) { if (spot == null) { spot = new Spot(RADIUS); } spot.x = event.getX(); spot.y = event.getY(); repaint(); }

    11. Quiz Use the API documentation for the Java 2 Platform to answer these questions: The ClickMe application uses Color.red to set the drawing color to red. • What other colors can you get by name like this? • How would you specify other colors, like purple? Now, use what you learned from the Java API to make the following modifications to the ClickMe Program: (To compile this program, you also need the Spot.java file.) • Modify the application to draw a green square instead of a red spot. • Modify the application to display your name in purple instead of a red spot.

    12. Summary – Java Class