Presentation is loading. Please wait.

Presentation is loading. Please wait.

Important Notes Pay attention to file names!!! You must name them what we tell you to. mkdir – make a folder (make the ones we tell you to) rm – remove.

Similar presentations


Presentation on theme: "Important Notes Pay attention to file names!!! You must name them what we tell you to. mkdir – make a folder (make the ones we tell you to) rm – remove."— Presentation transcript:

1 Important Notes Pay attention to file names!!! You must name them what we tell you to. mkdir – make a folder (make the ones we tell you to) rm – remove files (don’t do this unless you are sure you want to remove them) *, tab complete, up arrow, mv Any questions on FTP??

2 Debugging Exercise Name the three errors in the following program:
public class FamousSpeech public static void main(String [ ]) { System.out.println(“Four score and seven years ago,”); System.out.println(“…”); /* this part should say System.out.println(“…”); the rest of the speech */ }

3 Correct Version Name the three errors in the following program:
public class FamousSpeech { public static void main(String [ ] args) { System.out.println(“Four score and seven years ago,”); System.out.println(“…”); // this part should say System.out.println(“…”); // the rest of the speech }

4 Procedural Decomposition
Public class Confusing { public static void method2() { method1(); System.out.println(“I am method 2.”); } public static void method3() { method2(); System.out.println(“I am method 3.”); public static void method1() { System.out.println(“I am method 1.”); public static void main(String[] args) { method1(); method3(); method2(); }

5 Identifiers Which of the following can be used in a Java program as identifiers? println first-name AnnualSalary “hello” ABC 42isTheAnswer for sum_of_data _average B4

6 Identifiers Which of the following can be used in a Java program as identifiers? AnnualSalary ABC sum_of_data B4

7 Design Imagine you are writing a personal fitness program that stores the user’s age, gender, height (in feet or meters), and weight (to the nearest pound or kilogram). Declare variables with the appropriate names and types to hold this information.

8 Nested For Loops Write a program that prints out the multiplication table.

9 Nested For Loops Write a program the prints out the multiplication table. for(int row = 1; row <= 10; row ++) { for(int col = 1; col <= 10; col ++) { System.out.print(row*col); System.out.print(“\t“); } System.out.println();

10 Importing Classes and Input
import java.util.*; Scanner keyboard = new Scanner (System.in); int inputName = keyboard.nextInt(); Go to example input.java


Download ppt "Important Notes Pay attention to file names!!! You must name them what we tell you to. mkdir – make a folder (make the ones we tell you to) rm – remove."

Similar presentations


Ads by Google