• The Java Programming Language
  • Java Program Structure
  • Chapter 1: Computer Systems




    Download 225,5 Kb.
    bet7/10
    Sana22.07.2024
    Hajmi225,5 Kb.
    #268238
    1   2   3   4   5   6   7   8   9   10
    Bog'liq
    slides01

    Problem Solving

    • Many software projects fail because the developer didn't really understand the problem to be solved
    • We must avoid assumptions and clarify ambiguities
    • As problems and their solutions become larger, we must organize our development into manageable pieces
    • This technique is fundamental to software development
    • We will dissect our solutions into pieces called classes and objects, taking an object-oriented approach

    The Java Programming Language

    • A programming language specifies the words and symbols that we can use to write a program
    • A programming language employs a set of rules that dictate how the words and symbols can be put together to form valid program statements
    • Java was created by Sun Microsystems, Inc.
    • It was introduced in 1995 and has become quite popular
    • It is an object-oriented language

    Java Program Structure

    • 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
    • See Lincoln.java (page 26)

    Java Program Structure

    • public class MyProgram
    • {
    • }
    • // comments about the class
    • class header
    • class body
    • Comments can be added almost anywhere

    Java Program Structure

    • public class MyProgram
    • {
    • }
    • public static void main (String[] args)
    • {
    • }
    • // comments about the class
    • // comments about the method
    • method header
    • method body

    Download 225,5 Kb.
    1   2   3   4   5   6   7   8   9   10




    Download 225,5 Kb.