O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 1 Java Pros and Cons − Roundtable American Nuclear Society Annual Meeting June 16, 2004.

Slides:



Advertisements
Similar presentations
A Programmer's Introduction to Java - from a S/370 user (c) IDMS/SQL News
Advertisements

OO Programming in Java Objectives for today: Overriding the toString() method Polymorphism & Dynamic Binding Interfaces Packages and Class Path.
C++ Programming Languages
Portability and Safety Mahdi Milani Fard Dec, 2006 Java.
Lab Information Security Using Java (Review) Lab#0 Omaima Al-Matrafi.
Lab#1 (14/3/1431h) Introduction To java programming cs425
ITEC200 – Week03 Inheritance and Class Hierarchies.
The Java Programming Language
Inheritance and Class Hierarchies Chapter 3. Chapter 3: Inheritance and Class Hierarchies2 Chapter Objectives To understand inheritance and how it facilitates.
OOP in Java Nelson Padua-Perez Chau-Wen Tseng Department of Computer Science University of Maryland, College Park.
Data Structure: Java Programming 1 Min Chen School of Computer Science and Engineering Seoul National University.
Principles of Object-Oriented Software Development The language Java.
C#.NET C# language. C# A modern, general-purpose object-oriented language Part of the.NET family of languages ECMA standard Based on C and C++
Java for High Performance Computing Jordi Garcia Almiñana 14 de Octubre de 1998 de la era post-internet.
Session-02. Objective In this session you will learn : What is Class Loader ? What is Byte Code Verifier? JIT & JAVA API Features of Java Java Environment.
Copyright © 2009 Pearson Education, Inc. Publishing as Pearson Addison-Wesley Java Software Solutions Foundations of Program Design Sixth Edition by Lewis.
01 Introduction to Java Technology. 2 Contents History of Java What is Java? Java Platforms Java Virtual Machine (JVM) Java Development Kit (JDK) Benefits.
Java Course Outline Kumar Harshit, USW. Course Description Teaches students to program using the Java programming language with the help of the Netbeans.
Sadegh Aliakbary Sharif University of Technology Fall 2011.
Introduction to Java Programming. Contents 1. Java, etc. 2. Java's Advantages 3. Java's Disadvantages 4. Types of Java Code 5. Java Bytecodes 6. Steps.
JAVA v.s. C++ Programming Language Comparison By LI LU SAMMY CHU By LI LU SAMMY CHU.
BASIC JAVA PROGRAMMING TUTORIAL. History  James Gosling and Sun Microsystems  Oak  Java, May 20, 1995, Sun World  Hot Java –The first Java-enabled.
Principles of Computer Programming (using Java) Review Haidong Xue Summer 2011, at GSU.
Programming Languages and Paradigms Object-Oriented Programming.
Lecturer PEN PHIROM Tel : Web site: Lecturer PEN PHIROM Tel :
C++ Programming. Table of Contents History What is C++? Development of C++ Standardized C++ What are the features of C++? What is Object Orientation?
Sadegh Aliakbary Sharif University of Technology Spring 2011.
CSM-Java Programming-I Spring,2005 Objects and Classes Overview Lesson - 1.
Sadegh Aliakbary Sharif University of Technology Fall 2010.
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.
Liang, Introduction to Java Programming, Sixth Edition, (c) 2007 Pearson Education, Inc. All rights reserved Programming Languages Machine.
Introduction to Programming Languages. Problem Solving in Programming.
Programming With Java ICS201 University Of Ha’il1 Chapter 8 Polymorphism and Abstract Classes.
1 Module Objective & Outline Module Objective: After completing this Module, you will be able to, appreciate java as a programming language, write java.
Java. Features of Java Architecture Neutral and Portable o Write once, run anywhere o Java Virtual Machine (JVM) Object Oriented o Classes encapsulate.
1 Computer Systems -- Introduction  Chapter 1 focuses on:  the structure of a Java application  basic program elements  preparing and executing a program.
University of Houston-Clear Lake Proprietary© 1997 Evolution of Programming Languages Basic cycle of improvement –Experience software difficulties –Theory.
Module Overview n Module Title: OO Programming n Module Code: MIT3446 n Module Value: 3.0 n Duration: 15 weeks n Class-Contact Hours: Lecture15 hrs n Lab/Tutor30hrs.
Introduction and Features of Java. What is java? Developed by Sun Microsystems (James Gosling) A general-purpose object-oriented language Based on C/C++
CS591x A very brief introduction to Java. Java Developed by Sun Microsystems was intended a language for embedded applications became a general purpose.
Core Java: Essential Features 08/05/2015 Kien Tran.
Introduction to Object Oriented Programming CMSC 331.
Java Objects and Classes. Overview n Creating objects that belong to the classes in the standard Java library n Creating your own classes.
Java 5 Part 1 CSE301 University of Sunderland Harry Erwin, PhD.
Computer Programming 2 Why do we study Java….. Java is Simple It has none of the following: operator overloading, header files, pre- processor, pointer.
We will talking about story of JAVA language. By Kristsada Songpartom.
CT1513 Introduction To java © A.AlOsaimi.
Types in programming languages1 What are types, and why do we need them?
Applied Computing Technology Laboratory QuickStart Java Learning to Program in Java Dr. Tom Way October 21, 2005.
Core Java Introduction Byju Veedu Ness Technologies httpdownload.oracle.com/javase/tutorial/getStarted/intro/definition.html.
1. An Introduction A Programming Language A Technology Java Development Kit Java API One Language: Three Editions Standard Edition Enterprise Edition.
Liang, Introduction to Java Programming, Fifth Edition, (c) 2005 Pearson Education, Inc. All rights reserved Chapter 6 Objects and Classes.
Java Example Presentation of a Language. Background Conception: Java began as a language for embedded processors in consumer electronics, such as VCR,
Object Oriented Programming in Java Lecture 14. Review Quiz 1. Write a method which gets an Object and call all its available ‘get’ Methods and print.
Duke CPS From C++ to Java l Java history: Oak, toaster-ovens, internet language, panacea l What it is ä O-O language, not a hybrid (cf. C++)
Inheritance and Class Hierarchies Chapter 3. Chapter Objectives  To understand inheritance and how it facilitates code reuse  To understand how Java.
Chapter 11: Advanced Inheritance Concepts. Objectives Create and use abstract classes Use dynamic method binding Create arrays of subclass objects Use.
CSCI 212 Object-Oriented Programming in Java. Prerequisite: CSCI 111 variable assignment statement while loop for loop post-increment (i++) strong typing.
JAVA TRAINING IN NOIDA. JAVA Java is a general-purpose computer programming language that is concurrent, class-based, object-oriented and specifically.
Object Based Programming Chapter 8. 2 Contrast ____________________ Languages –Action oriented –Concentrate on writing ________________ –Data supports.
 It is a pure oops language and a high level language.  It was developed at sun microsystems by James Gosling.
Sung-Dong Kim, Dept. of Computer Engineering, Hansung University Java - Introduction.
JAVA MULTIPLE CHOICE QUESTION.
Chapter No. : 1 Introduction to Java.
Introduction to Advanced Java Programming
Internet and Java Foundations, Programming and Practice
An Overview of Java.
From C++ to Java Java history: Oak, toaster-ovens, internet language, panacea What it is O-O language, not a hybrid (cf. C++) compiled to byte-code, executed.
(Computer fundamental Lab)
Java History, Editions, Version Features
Presentation transcript:

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 1 Java Pros and Cons − Roundtable American Nuclear Society Annual Meeting June 16, 2004 Pittsburgh, PA

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 2 Java – an Object-Oriented Programming Language  Based on objects: data and methods together  Four Concepts:  Abstraction – describes physical world  Encapsulation – data and methods together  Inheritance - just like something else but...  Polymorphism – method overloading

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 3 Abstraction / Encapsulation public class Particle { Position position; Direction direction; double energy; public Particle(){ position = new Position(0, 0, 0); direction = new Position(1, 0, 0); energy = 1.0; } public void move(double distance){ position.move(direction, distance); } public void scat(double t, double p){... } public class Position { double x, y, z; public Position(double a, double b, double c){ x = a; y = b; z = c; } public void move(Direction d, double dis){ x = x + d.u*dis; y = y + d.v*dis; z = z + d.w*dis; } public double howFarTo(Position p){ double answer = (p.x-x)*(p.x-x) + (p.y-y)*(p.y-y) + (p.z-z)*(p.z-z); answer = Math.sqrt( answer ); return answer; }

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 4 Inheritance (1/2) public class ChargedParticle extends Particle { double restMass; int charge; // Physical Constants static double ELEMCHARGE = e-19; // Coulombs static double RESTMASSKG = e-31; // kg static double RESTMASS = 0.511; // MeV static double ERADIUS = e-15; // meter public ChargedParticle(){ super(); restMass = ChargedParticle.RESTMASS; charge = -1; } public double getSpeed(){ double speed =... (energy-restMass)... return speed; }

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 5 Inheritance (2/2) public class Photon extends Particle { // Physical Constants static double speedOfLight = ; // m/s static double planckConstant = e-34; // Joule seconds public Photon(){ super(); } public Particle[] comptonScatter(){ Particle[] answer = new Particle[2]; // photoelectron answer[0] = new ChargedParticle(...); // scattered photon answer[1] = new Photon(...); return answer; }

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 6 Polymorphism public class Particle { Position position; Direction direction; double energy; public Particle(){ position = new Position(0, 0, 0); direction = new Position(1, 0, 0); energy = 1.0; } public Particle(Position p, Direction d, double e){ position = p direction = d; energy = e; } public Particle(Particle p){ position = p.position; direction = p.direction; energy = p.energy; }

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 7 Java Pros  Free, freely distributable  Portable – “Write once, run anywhere”  Internet savvy  Extensive libraries – database, GUI, networking, etc.  Language – strongly typed, array indices are checked, automatic garbage collection, Threads, Exceptions  *.jar files – Java archive, runnable

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 8 Java Cons  Interpreted

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 9

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 10

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 11

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 12

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 13

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 14

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 15

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 16

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 17

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 18 Java 1.5 “Tiger”  Generics - no casting, errors at compile time, not runtime  Enhanced for Loop  Autoboxing/Unboxing - collections of primitive data types  Formatted Output - more like C or FORTRAN  New JVM Profiling API  Improved Diagnostic Ability - getStackTrace, Thread.getAllStackTraces private void printCollection(Collection c) { Iterator i = c.iterator(); while(i.hasNext()) { String item = i.next(); System.out.println("Item: "+item); } public void newFor(Collection c) { for(String str : c) { System.out.println(str); } System.out.printf("%s %3d", name, age);

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 19 Sun Microsystems, Inc. Binary Code License Agreement for the JAVATM 2 SOFTWARE DEVELOPMENT KIT (J2SDK), STANDARD EDITION, VERSION 1.4.2_X 3. RESTRICTIONS.... You acknowledge that Licensed Software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility....

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 20 Sun Microsystems, Inc. Binary Code License Agreement for the JAVATM 2 SOFTWARE DEVELOPMENT KIT (J2SDK), STANDARD EDITION, VERSION 1.4.2_X 3. RESTRICTIONS.... You acknowledge that Licensed Software is not designed or intended for use in the design, construction, operation or maintenance of any nuclear facility....

O AK R IDGE N ATIONAL L ABORATORY U. S. D EPARTMENT OF E NERGY 21 Any Questions?