And symbols that we can use to write a program

This preview shows page 9 - 18 out of 35 pages.

and symbols that we can use to write a program employs a set of rules (syntax) that dictate how the words and symbols can be put together to form valid program statements Defines the meaning (semantics) of program statements Java was created by Sun Microsystems and introduced in 1995 (acquired by Oracle, 2010) Java continues to evolve and grow in importance to the software industry
Image of page 9

Subscribe to view the full document.

COMP 1210 – Fundamentals of Computing I Slide 1 - 10 Java Program Structure In the Java programming language: A program is made up of one or more classes A class contains data and/or methods A method contains local data and program statements that form an algorithm These terms will be explored in detail throughout the course A Java application has a class containing a method called main
Image of page 10
COMP 1210 – Fundamentals of Computing I Slide 1 - 11 First Program with jGRASP 1. Start up jGRASP 2. Open a new file 3. Enter the program (incrementally) - The program should print “War Eagle” 4. Save program 5. Compile program 6. Run program (check for correct output) 7. Set a breakpoint and Debug (step through each statement 8. Generate CSD, Line No., and Documentation
Image of page 11

Subscribe to view the full document.

COMP 1210 – Fundamentals of Computing I Slide 1 - 12 jGRASP FirstProgram.java
Image of page 12
COMP 1210 – Fundamentals of Computing I Slide 1 - 13 jGRASP FirstProgramWithComments.java
Image of page 13

Subscribe to view the full document.

COMP 1210 – Fundamentals of Computing I Slide 1 - 14 Software Concepts Algorithms and Data Dissecting a Java Program Program Development, Translation, and Execution Syntax, Semantics, and Errors Overview of Programming Languages Object-Oriented Programming Applets vs. Applications
Image of page 14
COMP 1210 – Fundamentals of Computing I Slide 1 - 15 Algorithms and Data Sw ::= algorithms (“instructions”) and data Algorithms ::= Sequence, Selection, Iteration of instructions Pseudo-code (initial prog. design) becomes “formal” program (i.e., code in a programming language like Java) Pseudo-code can become comments in the program Many pieces of code for algorithms and data Organized into classes which define objects (Object-Oriented Programming)
Image of page 15

Subscribe to view the full document.

COMP 1210 – Fundamentals of Computing I Slide 1 - 16 Dissecting a Java Program /** * Prints the line "War Eagle!" three times * to standard output. * * @author James Cross * @version 8-15-2011 */ public class FirstProgram { /** * Prints "War Eagle!" three times. * * @param args Command line arguments (not used). */ public static void main(String[] args) { System.out.println( "War Eagle!" ); System.out.println( "War Eagle!!" ); System.out.println( "War Eagle!!!" ); } }
Image of page 16