CS591x A very brief introduction to Java. Java Developed by Sun Microsystems was intended a language for embedded applications became a general purpose.

Slides:



Advertisements
Similar presentations
Designing a Program & the Java Programming Language
Advertisements

A Programmer's Introduction to Java - from a S/370 user (c) IDMS/SQL News
Programming for Beginners Martin Nelson Elizabeth FitzGerald Lecture 3: Flow Control I: For Loops.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
Shlomo Hershkop1 Introduction to java Class 1 Fall 2003 Shlomo Hershkop.
Introduction to Java Programming
CS-341 Dick Steflik Introduction. C++ General purpose programming language A superset of C (except for minor details) provides new flexible ways for defining.
Introduction to Java CS 331. Introduction Present the syntax of Java Introduce the Java API Demonstrate how to build –stand-alone Java programs –Java.
Chapter 2 - Java Programming Fundamentals1 Chapter 2 Java Programming Fundamentals.
A Short Introduction to JAVA
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.
CSE 1301 J Lecture 2 Intro to Java Programming Richard Gesick.
CMSC 341 Introduction to Java Based on tutorial by Rebecca Hasti at
Programming in Java; Instructor:Moorthy Introduction, Objects, Classes, Libraries1 Programming in Java Introduction.
An intro to programming. The purpose of writing a program is to solve a problem or take advantage of an opportunity Consists of multiple steps:  Understanding.
DAT602 Database Application Development Lecture 5 JAVA Review.
By Nicholas Policelli An Introduction to Java. Basic Program Structure public class ClassName { public static void main(String[] args) { program statements.
Session One Introduction. Personal Introduction Role of programmers Robot Examination HUD & HID Uploading Code.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and Server Side Programming Very rich GUI libraries Portability (machine independence) A.
CS 11 java track: lecture 1 Administrivia need a CS cluster account cgi-bin/sysadmin/account_request.cgi need to know UNIX
JAVA Tokens. Introduction A token is an individual element in a program. More than one token can appear in a single line separated by white spaces.
Introduction to Computer Systems and the Java Programming Language.
© 2012 Pearson Education, Inc. All rights reserved. 1-1 Why Java? Needed program portability – Program written in a language that would run on various.
Java Programming, Second Edition Chapter One Creating Your First Java Program.
Java means Coffee Java Coffee Beans The name “JAVA” was taken from a cup of coffee.
Basics of Java IMPORTANT: Read Chap 1-6 of How to think like a… Lecture 3.
Java Programming Presented by Daniel Rosenthal Friday, November 30 th, 2007.
Introduction to java Prepared By:-Pragnesh Patel Lect. In Computer Dept. NSIT,Jetalpur 1.
Netprog: Java Intro1 Crash Course in Java. Netprog: Java Intro2 Why Java? Network Programming in Java is very different than in C/C++ –much more language.
1 Introduction to Java. 2 What is Java? A programming language. A platform –A virtual machine (JVM) definition. –Runtime environments in diverse hardware.
An Introduction to Java – Part 1 Dylan Boltz. What is Java?  An object-oriented programming language  Developed and released by Sun in 1995  Designed.
National Taiwan University Department of Computer Science and Information Engineering National Taiwan University Department of Computer Science and Information.
1 Programming Java Java Basics. 2 Java Program Java Application Program Application Program written in general programming language Applet Program running.
Fall 2015CISC124 - Prof. McLeod1 CISC124 Have you filled out the lab section survey? (As of last night 54 left to fill out the survey.) TA names have been.
1 CS 007: Introduction to Computer Programming Ihsan Ayyub Qazi.
BEGINNING PROGRAMMING.  Literally – giving instructions to a computer so that it does what you want  Practically – using a programming language (such.
Chapter 1: Introducing JAVA. 2 Introduction Why JAVA Applets and web applications Very rich GUI libraries Portability (machine independence) A real Object.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
Java Nuts and Bolts Variables and Data Types Operators Expressions Control Flow Statements Arrays and Strings.
 In the java programming language, a keyword is one of 50 reserved words which have a predefined meaning in the language; because of this,
Developed at Sun Microsystems in 1991 James Gosling, initially named “OAK” Formally announced java in 1995 Object oriented and cant write procedural.
© 2012 Pearson Education, Inc. All rights reserved types of Java programs Application – Stand-alone program (run without a web browser) – Relaxed.
Java FilesOops - Mistake Java lingoSyntax
Getting Started With Java September 22, Java Bytecode  Bytecode : is a highly optimized set of instructions designed to be executed by the Java.
Introduction to Java John Lewis. Course Overview Introduction Object Orientated Programming Java Structure and Syntax Using the Java Platform Advanced.
Spring 2009 Programming Fundamentals I Java Programming XuanTung Hoang Lecture No. 8.
An Introduction to Java – Part 1 Erin Hamalainen CS 265 Sec 001 October 20, 2010.
Chapter 1 Java Programming Review. Introduction Java is platform-independent, meaning that you can write a program once and run it anywhere. Java programs.
Lecture1 Instructor: Amal Hussain ALshardy. Introduce students to the basics of writing software programs including variables, types, arrays, control.
3/5/2002e-business and Information Systems1 Java Java Java Virtual Machine (JVM) Java Application Program Interface (API) HW Kernel API Application Programs.
Java Computer Industry Lab. 1 Programming Java Java Basics Incheon Paik.
Introduction to 1. What is Java ? Sun Microsystems Java is a programming language and computing platform first released by Sun Microsystems in The.
Object Oriented Programming Lecture 2: BallWorld.
SESSION 1 Introduction in Java. Objectives Introduce classes and objects Starting with Java Introduce JDK Writing a simple Java program Using comments.
CPSC 233 Tutorial January 21 st /22 nd, Linux Commands.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
CS-140 Dick Steflik Lecture 3. Java C++ Interpreted optimized for the internet Runs on virtual ized machine Derived from C++ Good object model Widely.
Topics introduced today (these topics would be covered in more detail in later classes) – Primitive Data types Variables Methods “for” loop “if-else” statement.
Intro to ETEC Java.
Chapter No. : 1 Introduction to Java.
Internet and Java Foundations, Programming and Practice
Introduction to Programming in Java
An Introduction to Java – Part I, language basics
Differences between Java and JavaScript
Introduction to Java Brief history of Java Sample Java Program
(Computer fundamental Lab)
Chap 1. Getting Started Objectives
Introduction to java Part I By Shenglan Zhang.
Review of Java Fundamentals
Presentation transcript:

CS591x A very brief introduction to Java

Java Developed by Sun Microsystems was intended a language for embedded applications became a general purpose language designed to support network programming

Java Java is a semi-compiled language Java compiler produces bytecode Bytecode not executable by itself like a binary executable (… except…) Must run Java bytecode in an execution environment Java Virtual Machine – JVM This give Java programs portability

Java Must download and install Java Software Developers Kit (SDK) A lot of kinds of Java out there You want J2SE SDK Download it from java.sun.com install You may want a Java IDE

Java - Installation Installation should be straight-forward download open the installer package see installation instructions on java.sun.com/j2se Follow installation instructions/answer questions

Java Java SDK comes with a number of tools Java compiler  javac myprogram.java  compiler produces class files Java runtime environment (JVM)  java myprog Java Archiver – jar  jar cvf myjar.jar myprog.class ….

Java – Basic Syntax public class myprog { public static void main(String[] args) { System.out.println(“Hello from myprog”); }

Java – Basic syntax a Java program must start with a class name class name must match the program’s file name compiler will produce a.class file with the same name

Java – Basic syntax Java programs contain classes and methods There are Java applications and Java applets A Java application must have a main method public static void main(String[] args){ … }

Java – Basic Syntax Classes have zero or more properties and zero or more methods properties are variables associated with class methods are procedures for operating on the class, objects or properties Objects are instances of classes

Java – sample program public class sample { public static void main(String[] args) { String str; str = “first string”; System.out.println(str); str = “2 nd string”; System.out.println(str); }

Java Data Types chr – single unicode character String – string of characters int – integer float – floating point number boolean – boolean value

Java – Data Types byte – single byte signed integer short – two byte signed integer long – very double precision integer double – double precision float

Java Arithmetic operators + - * / % use parentheses to set precedence Logical operators && - logical AND || logical OR ! logical NOT Assignment int x = 12; String st = “Hello”; float a = 12.5; a=b; a+=b; a-=b; a*=b; a/=b; a%=b; Comparison operators == != > = <=

Java Statements if (comparison-op) { code to be exec;} if (comparison-op) {do_this_code;} else {do_this_code_instead;} switch(num) { case 1 : {do_this;} case 2 : {do_that;} case 3 : {do_the_other;}

Java Statements for (initial_val; exit_test; increment) {iterative_code;} works just like c while (test_cond) { do_this_code;} do {do_this_code;} while (test_cond);

Java - Statements break; breaks out of a loop if (x==3) break; continue; drops through a loop if (x==3) continue; labels bigloop: for… continue bigloop;

Java Statements return – returns to the calling method can return values from called methods

Java - statements Arrays int[] x = {4,5,6}; String[] days = {“Monday”,”Tuesday”,…};