Chapter 1 Java Program Design and Development
|
|
|
- Charla Eaton
- 9 years ago
- Views:
Transcription
1 presentation slides for JAVA, JAVA, JAVA Object-Oriented Problem Solving Third Edition Ralph Morelli Ralph Walde Trinity College Hartford, CT published by Prentice Hall Java, Java, Java Object Oriented Problem Solving Chapter 1 Java Program Design and Development reserved. 1
2 Objectives Know the basic steps involved in program development. Understand some basic Java language elements. Know how to use simple output operations. Be able to identify different types of errors in a program. Understand how a Java program is translated into machine language. Understand the difference between a Java application and a Java applet. Know how to edit, compile, and run programs. Outline Designing Good Programs Designing a Riddle Program Java Language Elements Editing, Compiling, and Running a Java Program From the Java Library: The System and PrintStream classes. reserved. 2
3 Designing Good Programs Always precede coding with careful design. Remember: The sooner you begin to type code, the longer the program will take to finish. Design includes designing classes, data, methods, and algorithms. Design is followed by coding, testing, and revision. The Program Development Process Problem Specification Problem Decomposition Design Specification Data, Methods, and Algorithms Coding into Java Testing, Debugging, and Revising reserved. 3
4 Object-Oriented Program Development Problem Specification What exactly is the problem to be solved? How will the program be used? How will the program behave? Problem Specification: Design a class that represent a riddle with a given question and answer. The definition of this class should make it possible to store different riddles and retrieve a riddle s question and answer independently. reserved. 4
5 Problem Decomposition Divide-and-Conquer: What objects will be used and how will they interact? Nouns: In OOD, choosing objects means looking for nouns in the problem specification. Problem Specification: Design a class that represent a riddle with a given question and answer. The definition of this class should make it possible to store different riddles and retrieve a riddle s question and answer independently. Object Design Questions What role will the object perform? What data or information will it need? Look for nouns. Which actions will it take? Look for verbs. What interface will it present to other objects? These are public methods. What information will it hide from other objects? These are private. reserved. 5
6 Design Specification for a Riddle Class Name: Riddle Role: To represent a riddle Attributes (Information or instance variables) - Question: A variable to store the question (private) - Answer: A variable to store the answer (private) Behaviors (public methods) - Riddle(): A method to set a riddle s question and answer - getquestion(): A method to return a riddle s question - getanswer(): A method to return a riddle s answer UML Design Specification Instance variables -- memory locations used for storing the information needed. Class Name Hidden information Public interface What data does it need? What behaviors will it perform? Figure 1.3. A UML Class Diagram Methods -- blocks of code used to perform a specific task. reserved. 6
7 Method Design What specific task will the method perform? What information will it need to perform its task? What result will the method produce? What algorithm (step-by-step description of the solution) will the method use? Method Specification: getquestion() Method Name: getquestion() Task: To return the riddle s question Information Needed (variables) Question: A variable to store the riddle s answer (private) Algorithm: return question (This is a very simple method!) reserved. 7
8 Coding into Java public class Riddle extends Object { private String question; private String answer; // Class header // Instance variables public Riddle(String q, String a) // Constructor method { question = q; answer = a; } public String getquestion() { return question; } // getquestion() public String getanswer() { return answer; } // getanswer() // Access method // Access method } // Riddle class Syntax The syntax of a programming language is the set of rules that determines whether its statements are correctly formulated. Example Rule: All Java statements must end with a semincolon. Syntax error: question = q Syntax errors can be detected by the compiler, which will report an error message. reserved. 8
9 Semantics The semantics of a programming language is the set of rules that determine the meaning of its statements. Example Rule: In a + b, the + operator will add a and b. Semantic error: User intended to add a and b but coded a - b. Semantic errors cannot be detected by the compiler, because it can t read the programmer s mind. Java Language Elements A Java program is made up of class definitions. A class definition contains a header and a body. A method is a named section of code that can be called by its name. Multi-line and single-line comments are used to document the code. reserved. 9
10 Java Language Elements: Class Definition public class HelloWorld extends Object // Class header { // Start of class body private String greeting = Hello World! ; // Instance variable public void greet() // Method definition header { // Start of method body System.out.println(greeting); // Output statement } // greet() // End of greet method body public static void main(string args[]) // Method definition header { // Start of method body HelloWorld helloworld; // Reference variable helloworld = new HelloWorld(); // Object instantiation stmt helloworld.greet(); // Method call } // main() // End of method body } // HelloWorld // End of class body Java Keywords abstract continue for new switch assert default goto package synchronized boolean do if private this break double implements protected throw byte else import public throws case enum instanceof return transient catch extends int short try char final interface static void class finally long strictfp volatile const float native super while reserved. 10
11 Java Language Elements: Identifiers An identifier must begin with a letter (A to Z, a to z) and may be followed by any number of letters or digits (0 to 9) or underscores (_). An identifier may not be identical to a Java keyword. Style: Class names begin with a capital letter and use capitals to distinguish words within the name: HelloWord, TextField Style: Variable and method names begin with a lowercase letter and use capitals to distinguish words within the name: main(), getquestion() Data Types Java data are classified according to data type. Types of Objects (Riddle, Rectangle, String) versus primitive data types (int, double, boolean). A literal value is an actual value ( Hello, 5, true). Type Keyword Size in Bits Examples boolean boolean - true or false character char 16 A, 5, + byte byte to +127 integer short to integer int to integer long 64 really big numbers real number float , -0.45, 1.67e28 real number double , -0.45, 1.67e28 Java s Primitive Data Types. reserved. 11
12 Variables A variable is a typed container that can store a value of a certain type. Value Type Figure 1.6. A variable is a typed container. Statements A statement is a segment of code that takes some action in a program. A declaration statement declares a variable and has the general form: Type VariableName ; // Type variablename ; HelloWorld helloworld ; int int1, int2; reserved. 12
13 Assignment Statements An assignment statement stores a value in a variable and has the general form: VariableName = Value ; greeting = Hello World ; num1 = 50; num2 = ; num1 = num2; Figure 1.7 Figure 1.8. In the assignment num1 = num2 ; num2 s value is copied into num1. Expressions and Operators An expression is Java code that specifies or produces a value in the program. Expressions use operators (=, +, <, ) num1 + num2 // An addition of type int num1 < num2 // A comparison of type boolean num = 7 // An assignment expression of type int square(7) // A method call expression of type int num == 7 // An equality expression of type boolean Expressions occur within statements: num = square(7) ; // An assignment statement reserved. 13
14 Class Definition A Java program consists of one or more class definitions. A class definition contains a class header: ClassModifiers opt class ClassName Pedigree opt public class HellowWorld extends Object And a class body, which is code contained within curly brackets: { } public class HellowWorld extends Object { } Declaring an Instance Variable In general an instance variable declaration takes the following form: Modifiers opt Type VariableName InitialzerExpression opt private String greeting = Hello World ; int num; double realnum = 5.05; static int count = 0; In these examples the types are String, int, double and the variable names are greeting, num, realnum, and count. reserved. 14
15 Declaring an Instance Method A method definition consists of a method header: Modifiers opt ReturnType MethodName (ParameterList opt ) Followed by a method body, which is executable code contained within curly brackets: { } public void greet() // Method definition header { // Start of method body System.out.println(greeting); // Executable statement } // greet() // End of greet method body public static void main(string args[]) // Method definition header { HelloWorld helloworld; // Reference variable helloworld = new HelloWorld(); // Object instantiation stmt helloworld.greet(); // Method call } // main() Applications vs. Applets Java Applications Stand-alone program Runs independently Has a main() method No HTML file Run using JDK s java interpreter Java Applets Embedded program. Runs in a Web browser No main() method. Requires an HTML file Run using JDK s appletviewer reserved. 15
16 The HelloWorld Application public class HelloWorld extends Object // Class header { // Start of class body private String greeting = Hello World! ; // Instance variable public void greet() // Method definition header { // Start of method body System.out.println(greeting); // Output statement } // greet() // End of greet method body public static void main(string args[]) // Method definition header { // Start of method body HelloWorld helloworld; // Reference variable helloworld = new HelloWorld(); // Object instantiation stmt helloworld.greet(); // Method call } // main() // End of method body } // HelloWorld // End of class body The HelloWorldApplet Program /** * HelloWorldApplet program */ These statements import Java class names. import java.applet.applet; // Import the Applet class import java.awt.graphics; // and the Graphics class public class HelloWorldApplet extends Applet // Class header { // Start of body public void paint(graphics g) // The paint method { g.drawstring("helloworld!",10,10); } // End of paint } // End of HelloWorld This statement displays HelloWorld! on the browser window. reserved. 16
17 Qualified Names A qualified name takes the form reference.elementname where reference refers to some object (or class or package) and elementname is the name of one of the object s (or class s or package s) elements. Use: To refer to elements in Java s package, class, element hierarchy. Context dependent. System.out.println(); //println() method in System.out class pet1.eat(); // eat() method in pet1 object java.awt.button // Button class in java.awt package Editing, Compiling, and Running reserved. 17
18 The Java Development Process Step 1: Editing the Program Software: Any text editor will do. Step 2: Compiling the Program Software: Java Development Kit (JDK) JDK: javac HelloWorld.java Step 3: Running the Program JDK: java HelloWorld (Application) JDK: appletviewer file.html (Applet) Editing a Java Program Software: A text editor (vi, emacs, BBEdit). Program source code must be saved in a text file named HelloWorld.java where HelloWorld is the name of the public class contained in the file. Remember: Java class names and file names are case sensitive. reserved. 18
19 Compiling a Java Program Compilation translates the source program into Java bytecode. Bytecode is platform-independent JDK Command: javac HelloWorld.java Successful compilation will create the bytecode class file: HelloWorld.class Running a Java Application The class file (bytecode) is loaded into memory and interpreted by the Java Virtual Machine (JVM) JDK Command: java HelloWorld reserved. 19
20 Running a Java Applet Running an applet requires an HTML file containing an <applet> tag: <HTML>... <APPLET CODE= HelloWorldApplet.class WIDTH=200 HEIGHT=200> </APPLET>... </HTML> JDK Command: appletviewer file.html Browser: Open the applet s HTML file Running a HelloApplet Try running HelloWorldApplet reserved. 20
21 Coding into Java Stepwise Refinement is the right way to code. - Code small stages at a time, testing in between. - Errors are caught earlier. Syntax rules must be followed. - Syntax is the set of rules that determine whether a particular statement is correctly formulated Semantics must be understood. - Semantics refers to the meaning (effect on the program) of each Java statement. Testing, Debugging, and Revising Coding, testing, and revising a program is an iterative process. The java compiler catches syntactic errors, producing error messages. The programmer must test thoroughly for semantic errors. - Semantic errors are errors which manifest themselves through illogical output or behavior. - Errors are corrected in the debugging phase reserved. 21
22 Writing Readable Programs Style, in addition to working code, is the mark of a good programmer. Style consists of: - Readability. Code should be well-documented and easy to understand. - Clarity. Conventions should be followed and convoluted code avoided. - Flexibility. Code should be designed for easy maintenance and change. Java Library: System and PrintStream The java.lang.system class contains PrintStream objects that perform Input/Output (I/O). The java.lang.printstream class contains the print() and println() methods that perform output. reserved. 22
23 Example: OldMacDonald Program public class OldMacDonald // Class header { // Start of body public static void main(string argv[]) // Main method { System.out.println( Old MacDonald had a farm. ); System.out.println( E I E I O. ); System.out.println( And on his farm he had a duck. ); System.out.println( E I E I O. ); System.out.println( With a quack quack here. ); System.out.println( And a quack quack there. ); System.out.println( Here a quack, there a quack. ); System.out.println( Everywhere a quack quack. ); System.out.println( Old MacDonald had a farm ); System.out.println( E I E I O. ); } // End of main } // End of OldMacDonald Summary: Technical Terms algorithm applet application program assignment statement comment compound statement (block) data type declaration statement default constructor executable statement expression identifier keyword literal value object instantiation operator package parameter primitive data type pseudocode qualified name semantics stepwise refinement syntax reserved. 23
24 Summary: Key Points A Java applet is an embedded program that runs within the context of a WWW browser. Java applets are identified in HTML documents by using the <applet> tag. A Java application runs in stand-alone mode. Applications must have a main() method. Java programs are first compiled into bytecode and then interpreted by the Java Virtual Machine (JVM). Summary: Key Points A Java source program must be stored in a file that has a.java extension. A Java bytecode file has the same name as the source file but a.class extension. The name of the source file must be identical to the name of the public class defined in the file. Java is case sensitive. reserved. 24
25 Summary: Key Points Good program design requires that each object and each method have a well-defined task. Coding Java should follow the stepwise refinement approach. A stub method is a method with a complete header and an incomplete body. Summary: Key Points A syntax error results when a statement violates one of Java s grammar rules. A semantic error or logic error is an error in the program s design and cannot be detected by the compiler. Testing a program can only reveal the presence of bugs, not their absence. Good programs should be designed for readability, clarity, and flexibility. reserved. 25
26 Questions & Discussion reserved. 26
First Java Programs. V. Paúl Pauca. CSC 111D Fall, 2015. Department of Computer Science Wake Forest University. Introduction to Computer Science
First Java Programs V. Paúl Pauca Department of Computer Science Wake Forest University CSC 111D Fall, 2015 Hello World revisited / 8/23/15 The f i r s t o b l i g a t o r y Java program @author Paul Pauca
Introduction to Java
Introduction to Java The HelloWorld program Primitive data types Assignment and arithmetic operations User input Conditional statements Looping Arrays CSA0011 Matthew Xuereb 2008 1 Java Overview A high
CSE 452: Programming Languages. Acknowledgements. Contents. Java and its Evolution
CSE 452: Programming Languages Java and its Evolution Acknowledgements Rajkumar Buyya 2 Contents Java Introduction Java Features How Java Differs from other OO languages Java and the World Wide Web Java
Java Crash Course Part I
Java Crash Course Part I School of Business and Economics Institute of Information Systems HU-Berlin WS 2005 Sebastian Kolbe [email protected] Overview (Short) introduction to the environment Linux
Topics. Introduction. Java History CS 146. Introduction to Programming and Algorithms Module 1. Module Objectives
Introduction to Programming and Algorithms Module 1 CS 146 Sam Houston State University Dr. Tim McGuire Module Objectives To understand: the necessity of programming, differences between hardware and software,
CS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 01 / 21 / 2014 Instructor: Michael Eckmann Today s Topics Introduction Homework assignment Review the syllabus Review the policies on academic dishonesty and improper
The Java Series. Java Essentials I What is Java? Basic Language Constructs. Java Essentials I. What is Java?. Basic Language Constructs Slide 1
The Java Series Java Essentials I What is Java? Basic Language Constructs Slide 1 What is Java? A general purpose Object Oriented programming language. Created by Sun Microsystems. It s a general purpose
Moving from CS 61A Scheme to CS 61B Java
Moving from CS 61A Scheme to CS 61B Java Introduction Java is an object-oriented language. This document describes some of the differences between object-oriented programming in Scheme (which we hope you
Topics. Parts of a Java Program. Topics (2) CS 146. Introduction To Computers And Java Chapter Objectives To understand:
Introduction to Programming and Algorithms Module 2 CS 146 Sam Houston State University Dr. Tim McGuire Introduction To Computers And Java Chapter Objectives To understand: the meaning and placement of
An Overview of Java. overview-1
An Overview of Java overview-1 Contents What is Java Major Java features Java virtual machine Java programming language Java class libraries (API) GUI Support in Java Networking and Threads in Java overview-2
Basic Java Constructs and Data Types Nuts and Bolts. Looking into Specific Differences and Enhancements in Java compared to C
Basic Java Constructs and Data Types Nuts and Bolts Looking into Specific Differences and Enhancements in Java compared to C 1 Contents Hello World Program Statements Explained Java Program Structure in
Pemrograman Dasar. Basic Elements Of Java
Pemrograman Dasar Basic Elements Of Java Compiling and Running a Java Application 2 Portable Java Application 3 Java Platform Platform: hardware or software environment in which a program runs. Oracle
Chapter 2 Introduction to Java programming
Chapter 2 Introduction to Java programming 1 Keywords boolean if interface class true char else package volatile false byte final switch while throws float private case return native void protected break
Java Programming Fundamentals
Lecture 1 Part I Java Programming Fundamentals Topics in Quantitative Finance: Numerical Solutions of Partial Differential Equations Instructor: Iraj Kani Introduction to Java We start by making a few
Java CPD (I) Frans Coenen Department of Computer Science
Java CPD (I) Frans Coenen Department of Computer Science Content Session 1, 12:45-14:30 (First Java Programme, Inheritance, Arithmetic) Session 2, 14:45-16:45 (Input and Programme Constructs) Materials
Java Interview Questions and Answers
1. What is the most important feature of Java? Java is a platform independent language. 2. What do you mean by platform independence? Platform independence means that we can write and compile the java
JAVA - QUICK GUIDE. Java SE is freely available from the link Download Java. So you download a version based on your operating system.
http://www.tutorialspoint.com/java/java_quick_guide.htm JAVA - QUICK GUIDE Copyright tutorialspoint.com What is Java? Java is: Object Oriented Platform independent: Simple Secure Architectural- neutral
Introduction to Java Applications. 2005 Pearson Education, Inc. All rights reserved.
1 2 Introduction to Java Applications 2.2 First Program in Java: Printing a Line of Text 2 Application Executes when you use the java command to launch the Java Virtual Machine (JVM) Sample program Displays
ECE 122. Engineering Problem Solving with Java
ECE 122 Engineering Problem Solving with Java Introduction to Electrical and Computer Engineering II Lecture 1 Course Overview Welcome! What is this class about? Java programming somewhat software somewhat
Contents. Java - An Introduction. Java Milestones. Java and its Evolution
Contents Java and its Evolution Rajkumar Buyya Grid Computing and Distributed Systems Lab Dept. of Computer Science and Software Engineering The University of Melbourne http:// www.buyya.com Java Introduction
Introduction to Java Applets (Deitel chapter 3)
Introduction to Java Applets (Deitel chapter 3) 1 2 Plan Introduction Sample Applets from the Java 2 Software Development Kit Simple Java Applet: Drawing a String Drawing Strings and Lines Adding Floating-Point
How To Write A Program In Java (Programming) On A Microsoft Macbook Or Ipad (For Pc) Or Ipa (For Mac) (For Microsoft) (Programmer) (Or Mac) Or Macbook (For
Projet Java Responsables: Ocan Sankur, Guillaume Scerri (LSV, ENS Cachan) Objectives - Apprendre à programmer en Java - Travailler à plusieurs sur un gros projet qui a plusieurs aspects: graphisme, interface
Sources: On the Web: Slides will be available on:
C programming Introduction The basics of algorithms Structure of a C code, compilation step Constant, variable type, variable scope Expression and operators: assignment, arithmetic operators, comparison,
Java applets. SwIG Jing He
Java applets SwIG Jing He Outline What is Java? Java Applications Java Applets Java Applets Securities Summary What is Java? Java was conceived by James Gosling at Sun Microsystems Inc. in 1991 Java is
Handout 1. Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner.
Handout 1 CS603 Object-Oriented Programming Fall 15 Page 1 of 11 Handout 1 Introduction to Java programming language. Java primitive types and operations. Reading keyboard Input using class Scanner. Java
Introduction to programming
Unit 1 Introduction to programming Summary Architecture of a computer Programming languages Program = objects + operations First Java program Writing, compiling, and executing a program Program errors
Crash Course in Java
Crash Course in Java Based on notes from D. Hollinger Based in part on notes from J.J. Johns also: Java in a Nutshell Java Network Programming and Distributed Computing Netprog 2002 Java Intro 1 What is
Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2015 The third
CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals
CSE 1223: Introduction to Computer Programming in Java Chapter 2 Java Fundamentals 1 Recall From Last Time: Java Program import java.util.scanner; public class EggBasket { public static void main(string[]
Free Java textbook available online. Introduction to the Java programming language. Compilation. A simple java program
Free Java textbook available online "Thinking in Java" by Bruce Eckel, 4th edition, 2006, ISBN 0131872486, Pearson Education Introduction to the Java programming language CS 4354 Summer II 2014 Jill Seaman
Name: Class: Date: 9. The compiler ignores all comments they are there strictly for the convenience of anyone reading the program.
Name: Class: Date: Exam #1 - Prep True/False Indicate whether the statement is true or false. 1. Programming is the process of writing a computer program in a language that the computer can respond to
TABLE OF CONTENTS...2 INTRODUCTION...3 APPLETS AND APPLICATIONS...3 JAVABEANS...4 EXCEPTION HANDLING...5 JAVA DATABASE CONNECTIVITY (JDBC)...
Advanced Features Trenton Computer Festival May 1 sstt & 2 n d,, 2004 Michael P.. Redlich Senior Research Technician ExxonMobil Research & Engineering [email protected] Table of Contents
Computer Programming Tutorial
Computer Programming Tutorial COMPUTER PROGRAMMING TUTORIAL by tutorialspoint.com tutorialspoint.com i ABOUT THE TUTORIAL Computer Prgramming Tutorial Computer programming is the act of writing computer
Install Java Development Kit (JDK) 1.8 http://www.oracle.com/technetwork/java/javase/downloads/index.html
CS 259: Data Structures with Java Hello World with the IntelliJ IDE Instructor: Joel Castellanos e-mail: joel.unm.edu Web: http://cs.unm.edu/~joel/ Office: Farris Engineering Center 319 8/19/2015 Install
Java Cheatsheet. http://introcs.cs.princeton.edu/java/11cheatsheet/ Tim Coppieters Laure Philips Elisa Gonzalez Boix
Java Cheatsheet http://introcs.cs.princeton.edu/java/11cheatsheet/ Tim Coppieters Laure Philips Elisa Gonzalez Boix Hello World bestand genaamd HelloWorld.java naam klasse main methode public class HelloWorld
Fundamentals of Java Programming
Fundamentals of Java Programming This document is exclusive property of Cisco Systems, Inc. Permission is granted to print and copy this document for non-commercial distribution and exclusive use by instructors
MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question.
Exam Name MULTIPLE CHOICE. Choose the one alternative that best completes the statement or answers the question. 1) The JDK command to compile a class in the file Test.java is A) java Test.java B) java
CSC 551: Web Programming. Spring 2004
CSC 551: Web Programming Spring 2004 Java Overview Design goals & features platform independence, portable, secure, simple, object-oriented, Programming models applications vs. applets vs. servlets intro
qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq
qwertyuiopasdfghjklzxcvbnmqwerty uiopasdfghjklzxcvbnmqwertyuiopasd fghjklzxcvbnmqwertyuiopasdfghjklzx cvbnmqwertyuiopasdfghjklzxcvbnmq Introduction to Programming using Java wertyuiopasdfghjklzxcvbnmqwertyui
Java Application Developer Certificate Program Competencies
Java Application Developer Certificate Program Competencies After completing the following units, you will be able to: Basic Programming Logic Explain the steps involved in the program development cycle
JavaScript: Control Statements I
1 7 JavaScript: Control Statements I 7.1 Introduction 2 The techniques you will learn here are applicable to most high-level languages, including JavaScript 1 7.2 Algorithms 3 Any computable problem can
Syllabus for CS 134 Java Programming
- Java Programming Syllabus Page 1 Syllabus for CS 134 Java Programming Computer Science Course Catalog 2000-2001: This course is an introduction to objectoriented programming using the Java language.
CS1020 Data Structures and Algorithms I Lecture Note #1. Introduction to Java
CS1020 Data Structures and Algorithms I Lecture Note #1 Introduction to Java Objectives Java Basic Java features C Java Translate C programs in CS1010 into Java programs 2 References Chapter 1 Section
UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming
UIL Computer Science for Dummies by Jake Warren and works from Mr. Fleming 1 2 Foreword First of all, this book isn t really for dummies. I wrote it for myself and other kids who are on the team. Everything
Installing Java. Table of contents
Table of contents 1 Jargon...3 2 Introduction...4 3 How to install the JDK...4 3.1 Microsoft Windows 95... 4 3.1.1 Installing the JDK... 4 3.1.2 Setting the Path Variable...5 3.2 Microsoft Windows 98...
Example of a Java program
Example of a Java program class SomeNumbers static int square (int x) return x*x; public static void main (String[] args) int n=20; if (args.length > 0) // change default n = Integer.parseInt(args[0]);
Web Development and Core Java Lab Manual V th Semester
Web Development and Core Java Lab Manual V th Semester DEPT. OF COMPUTER SCIENCE AND ENGINEERING Prepared By: Kuldeep Yadav Assistant Professor, Department of Computer Science and Engineering, RPS College
Object-Oriented Programming in Java
CSCI/CMPE 3326 Object-Oriented Programming in Java Class, object, member field and method, final constant, format specifier, file I/O Dongchul Kim Department of Computer Science University of Texas Rio
Java from a C perspective. Plan
Java from a C perspective Cristian Bogdan 2D2052/ingint04 Plan Objectives and Book Packages and Classes Types and memory allocation Syntax and C-like Statements Object Orientation (minimal intro) Exceptions,
Week 1: Review of Java Programming Basics
Week 1: Review of Java Programming Basics Sources: Chapter 2 in Supplementary Book (Murach s Java Programming) Appendix A in Textbook (Carrano) Slide 1 Outline Objectives A simple Java Program Data-types
Java (12 Weeks) Introduction to Java Programming Language
Java (12 Weeks) Topic Lecture No. Introduction to Java Programming Language 1 An Introduction to Java o Java as a Programming Platform, The Java "White Paper" Buzzwords, Java and the Internet, A Short
AP Computer Science Java Subset
APPENDIX A AP Computer Science Java Subset The AP Java subset is intended to outline the features of Java that may appear on the AP Computer Science A Exam. The AP Java subset is NOT intended as an overall
J a v a Quiz (Unit 3, Test 0 Practice)
Computer Science S-111a: Intensive Introduction to Computer Science Using Java Handout #11 Your Name Teaching Fellow J a v a Quiz (Unit 3, Test 0 Practice) Multiple-choice questions are worth 2 points
Programming Languages CIS 443
Course Objectives Programming Languages CIS 443 0.1 Lexical analysis Syntax Semantics Functional programming Variable lifetime and scoping Parameter passing Object-oriented programming Continuations Exception
Lecture 5: Java Fundamentals III
Lecture 5: Java Fundamentals III School of Science and Technology The University of New England Trimester 2 2015 Lecture 5: Java Fundamentals III - Operators Reading: Finish reading Chapter 2 of the 2nd
Masters programmes in Computer Science and Information Systems. Object-Oriented Design and Programming. Sample module entry test xxth December 2013
Masters programmes in Computer Science and Information Systems Object-Oriented Design and Programming Sample module entry test xxth December 2013 This sample paper has more questions than the real paper
Introduction to Object-Oriented Programming
Introduction to Object-Oriented Programming Programs and Methods Christopher Simpkins [email protected] CS 1331 (Georgia Tech) Programs and Methods 1 / 8 The Anatomy of a Java Program It is customary
Java Basics: Data Types, Variables, and Loops
Java Basics: Data Types, Variables, and Loops If debugging is the process of removing software bugs, then programming must be the process of putting them in. - Edsger Dijkstra Plan for the Day Variables
Embedded Systems. Review of ANSI C Topics. A Review of ANSI C and Considerations for Embedded C Programming. Basic features of C
Embedded Systems A Review of ANSI C and Considerations for Embedded C Programming Dr. Jeff Jackson Lecture 2-1 Review of ANSI C Topics Basic features of C C fundamentals Basic data types Expressions Selection
Third AP Edition. Object-Oriented Programming and Data Structures. Maria Litvin. Gary Litvin. Phillips Academy, Andover, Massachusetts
Third AP Edition Object-Oriented Programming and Data Structures Maria Litvin Phillips Academy, Andover, Massachusetts Gary Litvin Skylight Software, Inc. Skylight Publishing Andover, Massachusetts Skylight
Introduction to Java Programming. Kary Främling
Introduction to Java Programming Kary Främling Introduction to Java programming K.Främling Page 2 FOREWORD I originally wrote this document for the needs of the Java Basics course at Arcada Polytechnic
The C Programming Language course syllabus associate level
TECHNOLOGIES The C Programming Language course syllabus associate level Course description The course fully covers the basics of programming in the C programming language and demonstrates fundamental programming
RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE. CISY 105 Foundations of Computer Science
I. Basic Course Information RARITAN VALLEY COMMUNITY COLLEGE ACADEMIC COURSE OUTLINE CISY 105 Foundations of Computer Science A. Course Number and Title: CISY-105, Foundations of Computer Science B. New
LAB4 Making Classes and Objects
LAB4 Making Classes and Objects Objective The main objective of this lab is class creation, how its constructer creation, object creation and instantiation of objects. We will use the definition pane to
An Incomplete C++ Primer. University of Wyoming MA 5310
An Incomplete C++ Primer University of Wyoming MA 5310 Professor Craig C. Douglas http://www.mgnet.org/~douglas/classes/na-sc/notes/c++primer.pdf C++ is a legacy programming language, as is other languages
Chapter 3. Input and output. 3.1 The System class
Chapter 3 Input and output The programs we ve looked at so far just display messages, which doesn t involve a lot of real computation. This chapter will show you how to read input from the keyboard, use
SE 450 Object-Oriented Software Development. Requirements. Topics. Textbooks. Prerequisite: CSC 416
SE 450 Object-Oriented Software Development Instructor: Dr. Xiaoping Jia Office: CST 843 Tel: (312) 362-6251 Fax: (312) 362-6116 E-mail: [email protected] URL: http://se.cs.depaul.edu/se450/se450.html
Chapter 13: Program Development and Programming Languages
Understanding Computers Today and Tomorrow 12 th Edition Chapter 13: Program Development and Programming Languages Learning Objectives Understand the differences between structured programming, object-oriented
How to use the Eclipse IDE for Java Application Development
How to use the Eclipse IDE for Java Application Development Java application development is supported by many different tools. One of the most powerful and helpful tool is the free Eclipse IDE (IDE = Integrated
Introduction to Java Lecture Notes. Ryan Dougherty [email protected]
1 Introduction to Java Lecture Notes Ryan Dougherty [email protected] Table of Contents 1 Versions....................................................................... 2 2 Introduction...................................................................
The Basic Java Applet and JApplet
I2PUJ4 - Chapter 6 - Applets, HTML, and GUI s The Basic Java Applet and JApplet Rob Dempster [email protected] School of Computer Science University of KwaZulu-Natal Pietermaritzburg Campus I2PUJ4 - Chapter
C++ INTERVIEW QUESTIONS
C++ INTERVIEW QUESTIONS http://www.tutorialspoint.com/cplusplus/cpp_interview_questions.htm Copyright tutorialspoint.com Dear readers, these C++ Interview Questions have been designed specially to get
INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011
INTRODUCTION TO OBJECTIVE-C CSCI 4448/5448: OBJECT-ORIENTED ANALYSIS & DESIGN LECTURE 12 09/29/2011 1 Goals of the Lecture Present an introduction to Objective-C 2.0 Coverage of the language will be INCOMPLETE
Java with Eclipse: Setup & Getting Started
Java with Eclipse: Setup & Getting Started Originals of slides and source code for examples: http://courses.coreservlets.com/course-materials/java.html Also see Java 8 tutorial: http://www.coreservlets.com/java-8-tutorial/
Java Classes. GEEN163 Introduction to Computer Programming
Java Classes GEEN163 Introduction to Computer Programming Never interrupt someone doing what you said couldn't be done. Amelia Earhart Classes, Objects, & Methods Object-oriented programming uses classes,
File class in Java. Scanner reminder. Files 10/19/2012. File Input and Output (Savitch, Chapter 10)
File class in Java File Input and Output (Savitch, Chapter 10) TOPICS File Input Exception Handling File Output Programmers refer to input/output as "I/O". The File class represents files as objects. The
COSC 1020 3.0 Introduction to Computer Science I Section A, Summer 2005. Question Out of Mark A Total 16. B-1 7 B-2 4 B-3 4 B-4 4 B Total 19
Term Test #2 COSC 1020 3.0 Introduction to Computer Science I Section A, Summer 2005 Family Name: Given Name(s): Student Number: Question Out of Mark A Total 16 B-1 7 B-2 4 B-3 4 B-4 4 B Total 19 C-1 4
Installing Java (Windows) and Writing your First Program
Appendix Installing Java (Windows) and Writing your First Program We will be running Java from the command line and writing Java code in Notepad++ (or similar). The first step is to ensure you have installed
CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013
Oct 4, 2013, p 1 Name: CS 141: Introduction to (Java) Programming: Exam 1 Jenny Orr Willamette University Fall 2013 1. (max 18) 4. (max 16) 2. (max 12) 5. (max 12) 3. (max 24) 6. (max 18) Total: (max 100)
CS 111 Classes I 1. Software Organization View to this point:
CS 111 Classes I 1 Software Organization View to this point: Data Objects and primitive types Primitive types operators (+, /,,*, %). int, float, double, char, boolean Memory location holds the data Objects
1001ICT Introduction To Programming Lecture Notes
1001ICT Introduction To Programming Lecture Notes School of Information and Communication Technology Griffith University Semester 2, 2015 1 3 A First MaSH Program In this section we will describe a very
www.virtualians.pk CS506 Web Design and Development Solved Online Quiz No. 01 www.virtualians.pk
CS506 Web Design and Development Solved Online Quiz No. 01 Which of the following is a general purpose container? JFrame Dialog JPanel JApplet Which of the following package needs to be import while handling
#820 Computer Programming 1A
Computer Programming I Levels: 10-12 Units of Credit: 1.0 CIP Code: 11.0201 Core Code: 35-02-00-00-030 Prerequisites: Secondary Math I, Keyboarding Proficiency, Computer Literacy requirement Semester 1
Fundamentals of Programming and Software Development Lesson Objectives
Lesson Unit 1: INTRODUCTION TO COMPUTERS Computer History Create a timeline illustrating the most significant contributions to computing technology Describe the history and evolution of the computer Identify
Programming and Software Development CTAG Alignments
Programming and Software Development CTAG Alignments This document contains information about four Career-Technical Articulation Numbers (CTANs) for Programming and Software Development Career-Technical
Translating to Java. Translation. Input. Many Level Translations. read, get, input, ask, request. Requirements Design Algorithm Java Machine Language
Translation Translating to Java Introduction to Computer Programming The job of a programmer is to translate a problem description into a computer language. You need to be able to convert a problem description
WA2099 Introduction to Java using RAD 8.0 EVALUATION ONLY. Student Labs. Web Age Solutions Inc.
WA2099 Introduction to Java using RAD 8.0 Student Labs Web Age Solutions Inc. 1 Table of Contents Lab 1 - The HelloWorld Class...3 Lab 2 - Refining The HelloWorld Class...20 Lab 3 - The Arithmetic Class...25
Introduction to Java. CS 3: Computer Programming in Java
Introduction to Java CS 3: Computer Programming in Java Objectives Begin with primitive data types Create a main class with helper methods Learn how to call built-in class methods and instance methods
public static void main(string[] args) { System.out.println("hello, world"); } }
Java in 21 minutes hello world basic data types classes & objects program structure constructors garbage collection I/O exceptions Strings Hello world import java.io.*; public class hello { public static
The programming language C. sws1 1
The programming language C sws1 1 The programming language C invented by Dennis Ritchie in early 1970s who used it to write the first Hello World program C was used to write UNIX Standardised as K&C (Kernighan
Building Java Programs
Building Java Programs Chapter 3 Lecture 3-3: Interactive Programs w/ Scanner reading: 3.3-3.4 self-check: #16-19 exercises: #11 videos: Ch. 3 #4 Interactive programs We have written programs that print
C Compiler Targeting the Java Virtual Machine
C Compiler Targeting the Java Virtual Machine Jack Pien Senior Honors Thesis (Advisor: Javed A. Aslam) Dartmouth College Computer Science Technical Report PCS-TR98-334 May 30, 1998 Abstract One of the
Keil C51 Cross Compiler
Keil C51 Cross Compiler ANSI C Compiler Generates fast compact code for the 8051 and it s derivatives Advantages of C over Assembler Do not need to know the microcontroller instruction set Register allocation
Chapter 2: Elements of Java
Chapter 2: Elements of Java Basic components of a Java program Primitive data types Arithmetic expressions Type casting. The String type (introduction) Basic I/O statements Importing packages. 1 Introduction
Module 10. Coding and Testing. Version 2 CSE IIT, Kharagpur
Module 10 Coding and Testing Lesson 23 Code Review Specific Instructional Objectives At the end of this lesson the student would be able to: Identify the necessity of coding standards. Differentiate between
13 File Output and Input
SCIENTIFIC PROGRAMMING -1 13 File Output and Input 13.1 Introduction To make programs really useful we have to be able to input and output data in large machinereadable amounts, in particular we have to
Basic Programming and PC Skills: Basic Programming and PC Skills:
Texas University Interscholastic League Contest Event: Computer Science The contest challenges high school students to gain an understanding of the significance of computation as well as the details of
Programmierpraktikum
Programmierpraktikum Claudius Gros, SS2012 Institut für theoretische Physik Goethe-University Frankfurt a.m. 1 of 21 10/16/2012 09:29 AM Java - A First Glance 2 of 21 10/16/2012 09:29 AM programming languages
