Chapter1 - Introduction We begin by examining a very basic...

Info iconThis preview shows pages 1–5. Sign up to view the full content.

View Full Document Right Arrow Icon
1 1 Introduction ± We begin by examining a very basic Java program and using it to explore some initial programming concepts ± Chapter 1 focuses on ² Introducing the Java programming language ² Describing the steps involved in program compilation and execution ² Exploring the issues related to problem solving in general ² Discussing the activities involved in the software development process ² Presenting an overview of object-oriented principles 2 1.1 – A Java Program ± In the Java programming language ² a program is made up of one or more classes ² a class contains one or more methods ² a method contains program statements ± These terms will be explored in detail throughout the course ± A Java application always contains a method called main
Background image of page 1

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
2 3 1.1 – Lincoln.java //******************************************************************** // Lincoln.java Java Foundations // // Demonstrates the basic structure of a Java application. //******************************************************************** public class Lincoln { //----------------------------------------------------------------- // Prints a presidential quote. //----------------------------------------------------------------- public static void main (String[] args) { System.out.println ("A quote by Abraham Lincoln:"); System.out.println ("Whatever you are, be a good one."); } } 4 1.1 – Java Program Structure public class MyProgram { } // comments about the class class header class body Comments can be placed almost anywhere
Background image of page 2
3 5 1.1 – Java Program Structure public class MyProgram { } // comments about the class public static void main (String[] args) { } // comments about the method method header method body 6 1.1 – Comments ± Comments in a program are called inline documentation ± They should be included to explain the purpose of the program and describe processing steps ± They do not affect how a program works ± Java comments can take three forms // this comment runs to the end of the line /* this comment runs to the terminating symbol, even across line breaks */ /** this is a javadoc comment */
Background image of page 3

Info iconThis preview has intentionally blurred sections. Sign up to view the full version.

View Full DocumentRight Arrow Icon
4 7 1.1 – Identifiers ± Identifiers are the words a programmer uses in a program ² can be made up of letters, digits, the underscore character ( _ ), and the dollar sign ² cannot begin with a digit ± Java is case sensitive - Total, total, and TOTAL are different identifiers ± By convention, programmers use different case styles for different types of identifiers, such as ² title case for class names - Lincoln ² upper case for constants - MAXIMUM 8 1.1 – Identifiers ± Sometimes we choose identifiers ourselves when writing
Background image of page 4
Image of page 5
This is the end of the preview. Sign up to access the rest of the document.

This note was uploaded on 03/31/2008 for the course IST 240 taught by Professor Tracymullen during the Spring '08 term at Pennsylvania State University, University Park.

Page1 / 15

Chapter1 - Introduction We begin by examining a very basic...

This preview shows document pages 1 - 5. Sign up to view the full document.

View Full Document Right Arrow Icon
Ask a homework question - tutors are online