SlidePlayer

  • My presentations

Auth with social network:

Download presentation

We think you have liked this presentation. If you wish to download it, please recommend it to your friends in any social system. Share buttons are a little bit lower. Thank you!

Presentation is loading. Please wait.

Chapt. 1 Introduction to Core Java. Lecture 1: Overview of Java.

Published by Susanna Caldwell Modified over 9 years ago

Similar presentations

Presentation on theme: "Chapt. 1 Introduction to Core Java. Lecture 1: Overview of Java."— Presentation transcript:

Chapt. 1 Introduction to Core Java

1 pritisajja.info Unlocking the World of Java Programming….. Priti Srinivas Sajja February, 2014 Visit pritisajja.info for detail Future Technology for.

java basics presentation

Introduction To Java Objectives For Today â Introduction To Java â The Java Platform & The (JVM) Java Virtual Machine â Core Java (API) Application Programming.

java basics presentation

Client Side Programming Using Java Applet Outcomes: You will be expected to know: – Java Applets and HTML file; –bytecode and platform independent programs;

java basics presentation

George Blank University Lecturer. CS 602 Java and the Web Object Oriented Software Development Using Java Chapter 4.

java basics presentation

Introduction to Java Kiyeol Ryu Java Programming Language.

java basics presentation

Introduction to Java Programming, 4E

java basics presentation

Chapter 1 Introduction.

java basics presentation

JAVA ENVIRONMENT JDK, API, JVM. JAVA ENVIRONMENT  Java environment includes development tools and many classes and methods. Java Environment JDK (Java.

java basics presentation

Introduction to Java.

java basics presentation

Lecture 1: Overview of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++ Designed.

java basics presentation

CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.

java basics presentation

Java Software Solutions Lewis and Loftus Chapter 2 1 Copyright 1997 by John Lewis and William Loftus. All rights reserved. Software Concepts -- Introduction.

java basics presentation

JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.

java basics presentation

+ Java vs. Javascript Jessi Style. + Java Compiled Can stand on its own Written once, run anywhere Two-stage debugging Java is an Object Oriented Programming.

java basics presentation

Introduction to Java Appendix A. Appendix A: Introduction to Java2 Chapter Objectives To understand the essentials of object-oriented programming in Java.

java basics presentation

Advanced Java New York University School of Continuing and Professional Studies.

java basics presentation

About the Java  Java technology is both a programming language and a platform –The Java Programming Language A high-level language that can be characterized.

java basics presentation

 Java Programming Environment  Creating Simple Java Application  Lexical Issues  Java Class Library.

java basics presentation

DAT602 Database Application Development Lecture 5 JAVA Review.

java basics presentation

Introduction to Programming Languages. Problem Solving in Programming.

About project

© 2024 SlidePlayer.com Inc. All rights reserved.

  • Request PPT
  • Privacy Policy

Basic JAVA Programming Tutorial PPT

  • Share on Facebook
  • Share on Twitter
  • Share on Google+
  • Share on Reddit
  • Share on Pinterest
  • Share on Linkedin
  • Share on Tumblr

basic java programming tutorial ppt

JAVA is one of the most widely used computer programming languages which is class-based, concurrent, and object-oriented. Java was designed in 1991 by James Gosling, Patrick Naughton, and Mike Sheridan for interactive television, but it looked to be more advanced at that time. It was first known as Oak and later it named as Green, and finally it got the name JAVA. The developers designed this language with almost similar syntax of C & C++ language, so that the app programmers will feel better to club with it.

A basic tutorial on Java Programming is shown in the below PPT:

Download (PPTX, 136KB)

  • More By Yogi
  • More In Computer

What is ChatGPT

What is ChatGPT PPT

swarm_robotics_ppt

Swarm Robotics PPT

java basics presentation

3D Printer PPT

java basics presentation

Blue Brain PPT

ChatGPT is a conversational language model developed by OpenAI. It is based on the GPT (Ge…

What is ChatGPT

Bio Mechatronic Hand PPT

hydraulics ppt

Hydraulics PPT

smart sensor ppt

Smart Sensors PPT

swarm_robotics_ppt

Chapter 01: �Introduction to Java

Lecturer: Mr. Sam Vanthath

  • To understand the relationship between Java and World Wide Web.
  • To know Java’s advantages.
  • To distinguish the terms API, IDE and JDK.
  • To write a simple Java program.
  • To create, compile and run Java programs.
  • To know the basic syntax of a Java program.
  • To display output on the console and on the dialog box.

1. Java, World Wide Web, and Beyond

2. Characteristics of Java

3. The Java Language Specification, API, JDK, and IDE

4. A Simple Java Program

5. Creating, Compiling, and Executing a Java Program

6. Anatomy of the Java Program

  • How to write Java application
  • Input and Output statements

1. Java, World Wide Web, and Beyond (P. 13)

  • Today Java is used for:
  • Web Programming
  • Developing standalone applications across platforms on
  • and mobile devices
  • Developing the code to communicate with and control the robotic rover that rolled on Mars.

2. Characteristics of Java (P. 16)

  • Java particular feature is to write a program once and run it everywhere.
  • Object-oriented

Distributed

Interpreted

  • Architecture-neutral
  • High-performance

Multithreaded

  • Easier than C++
  • Replace multiple inheritance in C++ with a simple language construct called an interface
  • Eliminate pointers
  • Use automatic memory allocation and garbage collection
  • Easy to write and read

Object-Oriented

  • Replace traditional procedure programming techniques.
  • OOP models the real world in terms of objects.
  • Central issue in software development is how to reuse code.
  • OOP provides great flexibility, modularity, clarity and reusability through encapsulation, inheritance, and polymorphism.
  • Several computers working together on a network.
  • Java is designed to make distributed computing easy.
  • Writing network programs in Java is like sending and receiving data to and from a file.
  • Unlike conventional language translators
  • Compiler converts source code into a machine-independent format (Byte code)
  • allow it to run on any computer H/W that has the Java runtime system (Java Virtual Machine)
  • Means reliable.
  • Java has a runtime exception-handling feature.
  • Java forces the programmer to write the code to deal with exceptions.
  • Java can catch and respond to an exceptional situation
  • so the program can continue its normal execution
  • and terminate gracefully when a runtime error occurs.
  • As an Internet programming language, Java is used in a networked and distributed environment.
  • If you download a Java applet and run it on your computer, it will not damage your system.

Architecture-Neutral

  • As Java is interpreted, this feature enables Java to be architecture-neutral or platform-independent.
  • Using Java, developers need to write only one version of software so it can run on every platform (Windows, OS/2, Macintosh, and various UNIX, IBM AS/400, and IBM mainframes).
  • Because Java is architecture-neutral, Java programs are portable.
  • They can be run on any platform without being recompiled.

Performance

  • Design well to perform on very low-power CPUs
  • Easy to translate directly to native machine code
  • Multithreading is a program’s capability to perform several tasks simultaneously (e.g: Downloading a video file while playing the video).
  • Multithreading is particularly useful in GUI programming (e.g: a user can listen to an audio recording while surfing the Web page) and network programming (e.g: A server can serve multiple clients at the same time).
  • Libraries can freely add new methods and instance variables.
  • New class can be loaded on the fly without recompilation.

3. The Java Language Specification, API, JDK, and IDE (P. 19)

  • Computer languages have strict rules of usages.
  • If you do not follow the rules when writing a program, the computer will be unable to understand it.
  • Java language specification and Java API define the Java standard.

Java Language specification & API

  • Java Language specification is a technical definition of the language that includes the syntax and semantics of the Java programming language.
  • The application programming interface (API) contains predefined classes and interfaces for developing Java programs.
  • The Java language specification is stable, but the API is still expanding.

Java API Editions

  • There are 3 editions of Java API: Java 2 Standard Edition (J2SE), Java 2 Enterprise Edition (J2EE) and Java 2 Micro Edition (J2ME).
  • J2SE: used to develop client-side standalone applications or applets.
  • J2EE: used to develop server-side applications, such as Java servlets and JavaServer Pages.
  • J2ME: used to develop applications for mobile devices, such as cell phones.

Java Development Toolkit (JDK)

  • For J2SE 5.0, the Java Development Toolkit is called JDK5.0, formerly known as JDK1.5.
  • JDK consists of a set of separate programs for developing and testing Java programs, each of which is invoked from a command line.
  • Besides JDK, there are more than a dozen Java development tools such as JBuilder, NetBeans, Sun ONE, Eclipse, JCreator, … These tools provide an integrated development environment (IDE) for rapidly developing Java programs (Editing, compiling, building, debugging and online help).

4. A Simple Java Program (P. 20)

  • There are 2 Java Programs: Java Applications and applets.
  • Java Applications can be executed from any computer with a Java interpreter.
  • Java applets can be run directly from a Java-compatible Web browser. Applets are suitable for deploying Web projects.

A simple java applicationcode

// This application program prints Welcome to Java!

public class Welcome {

  • public static void main(String[] args){

System.out.println( "Welcome to Java!" );

Class heading

Main method signature

5. Creating, Compiling, and Executing a Java Program (P. 21)

  • You have to create your program and compile it before it can be executed.
  • If your program has compilation errors, you have to fix them by modifying the program then recompile it.
  • If your program has runtime errors or does not produce the correct result, you have to modify the program, recompile it and execute it again.

6. Anatomy of the Java Program (P. 23)

  • The previous sample code has the following components:
  • Reserved words
  • The main method
  • Comments help programmers and users to communicate and understand the program.
  • Comments are ignored by the compiler.
  • A line comment: //
  • A paragraph comment: /*…*/

// This application prints Welcome!

/* This application prints Welcome!*/

/* This application prints

Reserved Words

  • Reserved Words or Keywords are words that have a specific meaning to the compiler and cannot be used for other purpose in the program.
  • E.g: class, public, static, void are keywords
  • Java uses certain reserved words called modifiers that specify the properties of the data, methods and classes and how they can be used.
  • E.g: public, static, private, final, abstract and protected
  • A statement represents an action or a sequence of actions.
  • The statement Systemout.println(“Welcome to Java!”) in previous code is a statement to display the greeting “Welcome to Java!”.
  • Every statement in Java ends with a semicolon (;).
  • The braces in the program form a block that groups the components of the program.
  • A block begins with ({) and ends with (}).
  • Every method has a method block that groups the statements in the method.
  • Blocks can be nested.

public class Test{

System.out.println(“Welcome to java!”);

Class block

Method block

  • The class is the essential Java construct.
  • To program in Java, you must understand classes and be able to write and use them.
  • A program is defined by using one or more classes.
  • Method consists of a collection of statements that perform a sequence of operations.
  • E.g: System.out.println?
  • System.out: the standard output object
  • println: the method in the object which to displays a message to the standard output device.

The main Method

  • Every Java application must have a user-declared main method that defines where the program begins.
  • The Java interpreter executes the application by invoking the main method.
  • The main method looks like this:
  • //Statemtns;

How to write Java applications

Two types of Java Program

  • Applet Program
  • Program which is running on Web Browser
  • Use Appletviewer or internet explorer
  • Application program
  • Typical application program
  • Execute using interpreter named “java”

Checkpoints for the Beginner

  • Java differentiates the upper- and lower- cases.
  • File differentiates the upper- and lower- cases.
  • Should set the environment variables correctly.
  • Run the program including main()
  • The format of main is always� public static void main (String args[])
  • Or public static void main (String[] args)
  • Applet class is always public.

Checkpoints for the Beginner (Cont.)

  • One file can have only one “public” class.�– compile error.
  • If there is a class declared “public”, then the file name should be same as that public class name.
  • Constructor doesn’t have a return type and has the same name as the class name.
  • There is no comma between width and height in the HTML file.��<applet code=class-file-name width=300 height=200>�</applet>

Rules of naming the class and method

  • English Noun type
  • Starts with upper-case letter
  • Coming multiple nouns : not with “_” , combine with another Uppercase.
  • Ex. Car, ChattingServer
  • Method Name
  • English Verb type
  • Starts with lower-case letter
  • Ex. getName(), setLabel()

Input and Output Statements

Printing a Line of Text Example (Welcome1.java)

// Welcome1.java

// Text-printing program.

public class Welcome1 {

// main method begins execution of Java application

public static void main( String args[] )

System.out.println( “Welcome to Java Programming!” );

} // end method main

} // end class Welcome1

Printing a Line of Text (Cont.)

Compiling a program

  • Open a command prompt window, go to directory where program is stored
  • Type javac Welcome1.java
  • If no errors, Welcome1.class created
  • Has bytecodes that represent application
  • Bytecodes passed to Java interpreter
  • Executing a program
  • Type java Welcome1
  • Interpreter loads .class file for class Welcome1
  • .class extension omitted from command
  • Interpreter calls method main

Modifying Our First Java Program

  • Modify example in Welcome1.java to print same contents using different code
  • Modifying programs
  • Welcome2.java produces same output as Welcome1.java
  • Using different code�System.out.print( "Welcome to " ); System.out.println( "Java Programming!" );
  • System.out.print( "Welcome to " ) displays “Welcome to ” with cursor remaining on printed line
  • System.out.println( "Java Programming!" ) displays “Java Programming!” on same line with cursor on next line

Example (Welcome2.java)

// Welcome2.java

public class Welcome2 {

System.out.print( “Welcome to ” );

System.out.println( “Java Programming!” );

} // end class Welcome2

Modifying Our First Java Program (Cont.)

Newline characters (\n)

  • Interpreted as “special characters” by methods System.out.print and System.out.println
  • Indicates cursor should be on next line
  • Welcome3.java�System.out.println( "Welcome\nto\nJava\nProgramming!" );
  • Line breaks at \n
  • Can use in System.out.println or System.out.print to create new lines

System.out.println( "Welcome\nto\nJava\nProgramming!" );

Example (Welcome3.java)

// Welcome3.java

public class Welcome3 {

} // end class Welcome3

  • Escape characters
  • Backslash ( \ ) indicates special characters to be output

Displaying Text in a Dialog Box

  • Most Java applications use windows or a dialog box
  • We have used command window
  • Class JOptionPane allows us to use dialog boxes
  • Set of predefined classes for us to use
  • Groups of related classes called packages
  • Group of all packages known as Java class library or Java applications programming interface (Java API)
  • JOptionPane is in the javax.swing package
  • Package has classes for using Graphical User Interfaces (GUIs)

Displaying Text in a Dialog Box (Cont.)

  • Upcoming program
  • Application that uses dialog boxes
  • Explanation will come afterwards
  • Demonstrate another way to display output
  • Packages, methods and GUI

Example (Welcome4.java)

// Welcome4.java

// Printing multiple lines in a dialog box.

// Java packages

import javax.swing.JOptionPane; // program uses JOptionPane

public class Welcome4 {

JOptionPane.showMessageDialog(

null , "Welcome\nto\nJava\nProgramming!" );

System.exit( 0 );

// terminate application with window

} // end class Welcome4

Another Java Application : Adding Integers

  • Use input dialogs to input two values from user
  • Use message dialog to display sum of the two values

Example (Addition.java)

// Addition.java

// Addition program that displays the sum of two numbers.

public class Addition {

String firstNumber; // first string entered by user

String secondNumber; // second string entered by user

int number1; // first number to add

int number2; // second number to add

int sum; // sum of number1 and number2

// read in first number from user as a String

firstNumber = JOptionPane.showInputDialog( "Enter first integer" );

// read in second number from user as a String

secondNumber =

JOptionPane.showInputDialog( "Enter second integer" );

Example (Addition.java) (Cont.)

// convert numbers from type String to type int

number1 = Integer.parseInt( firstNumber );

number2 = Integer.parseInt( secondNumber );

// add numbers

sum = number1 + number2;

// display result

JOptionPane.showMessageDialog( null , "The sum is " + sum, "Results" ,� JOptionPane.PLAIN_MESSAGE );

System.exit( 0 ); // terminate application with window

} // end class Addition

Review Questions

  • What is needed to run Java on a computer?
  • What are the input and output of a Java compiler?
  • Explain the Java keywords. List some that you have learned.
  • Is Java case-sensitive? What is the case for Java keyword?
  • What is the Java source filename extension, and what is the Java bytecode filename extension?
  • What is the statement to display a string on the console? What is the statement to display the message “Hello World” in a message dialog box?
  • Read Chapter01 Summary (P. 28-29)
  • Create a Java program that displays these text in a dialog:

I am a student at CMU.

I am practicing Java code.

“Thanks!!!”

  • Create a Java program that receives 3 input from users (Name, Midterm and Final score) and display the result on a dialog box:

Student Name: xxx xxx

Midterm score: xx pt

Final score: xx pt

Total score: xx pt

java basics presentation

Flipped classroom.

  • Each week, send an email to all students in the class that briefly describes activities for that week (lectures, reading, and programming assignments drawn from the book or from this booksite).
  • Students watch the lecture videos at their own pace, do the readings, and work on the programming assignments.

Self-study.

Available lectures..

Browse Course Material

Course info, instructors.

  • Adam Marcus

Departments

  • Electrical Engineering and Computer Science

As Taught In

  • Programming Languages
  • Software Design and Engineering

Learning Resource Types

Introduction to programming in java, lecture 1: types, variables, operators.

Lecture presentation on programming in Java. Topics include: the computer, CPU instructions, programming languages, Java, program structure, output, types, variables, and operators.

facebook

You are leaving MIT OpenCourseWare

IMAGES

  1. PPT

    java basics presentation

  2. PPT

    java basics presentation

  3. PPT

    java basics presentation

  4. PPT

    java basics presentation

  5. PPT

    java basics presentation

  6. PPT

    java basics presentation

VIDEO

  1. 🎉 Welcome to My Java Programming Series! 🎉

  2. java basics Part 2

  3. Java Basics in 60 Seconds! 🚀

  4. Java basics for automation testing Session 2| Example

  5. Java Tutorial ArrayList Common Algorithms

  6. Basics features of Java|java part 2

COMMENTS

  1. Chapt. 1 Introduction to Core Java. Lecture 1: Overview of Java

    Introduction Java is a programming language invented by James Gosling and others in originally named Oak,was developed as a part of the Green project at the Sun Company. A general-purpose object-oriented language Based on C/C++. Designed for easy Web/Internet applications. Widespread acceptance.

  2. Introduction To Java

    PPT slide on Introduction To Java compiled by Saurabh Saini. ... This ppt cover basic introduction of Core Java. It cover how to run Java hello word and what is the working internal working of Java compiler to run this program. Saurabh S / Delhi . 4 years of teaching experience.

  3. Basic JAVA Programming Tutorial PPT

    JAVA is one of the most widely used computer programming languages which is class-based, concurrent, and object-oriented. Java was designed in 1991 by James Gosling, Patrick Naughton, and Mike Sheridan for interactive television, but it looked to be more advanced at that time. It was first known as Oak and later it named as Green, and finally

  4. PartI-Chapter 01

    To understand the relationship between Java and World Wide Web. To know Java's advantages. To distinguish the terms API, IDE and JDK. To write a simple Java program. To create, compile and run Java programs. To know the basic syntax of a Java program. To display output on the console and on the dialog box.

  5. Java Basics

    PPT slide on Java Basics compiled by Pari Ramalingam. Disclaimer: LearnPick is an online tutoring marketplace and platform connecting students with excellent tutors and instructors. We neither supply nor recommend tutors to those in search of such services, and vice-versa.

  6. Introduction to Programming in Java

    This section provides the schedule of lecture topics, lecture presentations, and a special set of lecture files that can be annotated, Browse Course Material Syllabus Lecture Notes ... Introduction to Programming in Java. Menu. More Info Syllabus Lecture Notes Assignments Related Resources Lecture Notes. Abbreviations. API = Application ...

  7. Lectures

    Lecture 1: Intro to Java. Why program? This lecture addresses that basic question. Then it describes the anatomy of your first program and the process of developing a program in Java using either virtual terminals or a program development environment, with some historical context. Most of the lecture is devoted to a thorough coverage of Java's ...

  8. Lecture 4: Classes and Objects

    Lecture presentation on programming in Java. Topics include: object oriented programming, defining classes, using classes, constructors, methods, accessing fields, primitives versus references, references versus values, and static types and methods.

  9. Introduction To Java

    Java Program to print the largest element in an array; Java Program to print the smallest element in an array; Java Program to print the number of elements present in an array; Java Program to print the sum of all the items of the array; Java Program to right rotate the elements of an array; Java Program to sort the elements of an array in ...

  10. Lecture 1: Types, Variables, Operators

    Lecture presentation on programming in Java. Topics include: the computer, CPU instructions, programming languages, Java, program structure, output, types, variables, and operators. Browse Course Material Syllabus Lecture Notes Assignments Related Resources Course Info Instructors ...