Introduction to java programming
1 / 18

Introduction to Java Programming - PowerPoint PPT Presentation

  • Uploaded on

Introduction to Java Programming. Introduction. Java vs C++ Java Syntax Java API How to build stand-alone applications Examples. Java vs C++. Similar Syntax Run anywhere (Java), Compile anywhere (C++) No native support for unsigned arithmetic in Java

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

PowerPoint Slideshow about 'Introduction to Java Programming' - sally

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


  • Java vs C++

  • Java Syntax

  • Java API

  • How to build stand-alone applications

  • Examples

Java vs c
Java vs C++

  • Similar Syntax

  • Run anywhere (Java), Compile anywhere (C++)

  • No native support for unsigned arithmetic in Java

  • Automatic memory garbage collection in Java

  • Java runs in a virtual machine, C++ runs as native executable machine code

Java syntax
Java Syntax

  • The set of legal structures and commands that can be used in a particular programming language

Java syntax1
Java Syntax

class Foo {// Defines class Foo

privateint x;// Member variable, normally variables

// are declared as private to

// enforce encapsulation

//initialized to 0 by default


// Constructor for Foo


publicint bar(inti){

// Member method bar()

return3*i+ x;



Java syntax2
Java Syntax

Foo a;// declares a to be a reference to a Foo object

a =new Foo();// initializes using the default constructor

// Another constructor can be used as

Foo a =new Foo(args);

Java api
Java API

There are 3 types of Java Programming Language Application Programming Interfaces (APIs)

  • the official core Java API, contained in the JDK or JRE, of one of the editions of the Java Platform. The three editions of the Java Platform are Java ME (Micro edition), Java SE (Standard edition), and Java EE (Enterprise edition).

  • optional official APIs that can be downloaded separately. The specification of these APIs are defined according to a Java Specification Request (JSR), and sometimes some of these APIs are later included in the core APIs of the platform (the most notable example of this kind is Swing).

  • unofficial APIs, developed by third parties, but not related to any JSRs.

Java api1
Java API

  • For example Java Advanced Imaging (JAI) is a Java platform extension API that provides a set of object-oriented interfaces that support a simple, high-level programming model which allows developers to create their own image manipulation routines without the additional cost or licensing restrictions, associated with commercial image processing software.

Java se programming
Java SE Programming

  • Install the followings

    • Java Runtime Environment (JRE)

    • Java Development Kit (JDK)

    • Netbeans IDE

Java se programming1
Java SE Programming

  • Create a new Java project

    • Open NetBeans IDE

Java se programming2
Java SE Programming

  • Go to File->New Project...

  • Select Javathen select Java Application

Java se programming3
Java SE Programming

  • Click Next and enter Project Name then click Finish

Java se programming4
Java SE Programming

  • .java file is created

  • Public class is created

  • Application entry point is created as main() function inside the class

Java se programming6
Java SE Programming

  • Example

    • Declare a class as following inside the main class

Java se programming7
Java SE Programming

  • Then write the code below inside the main() function

Java se programming8
Java SE Programming

  • Run the application by pressing F6 button on the keyboard or click on the toolbars.

  • Then you should see the system output as below