List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs ar
|
|
- Juliana Lucas
- 5 years ago
- Views:
Transcription
1 List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs are divided into classes 7 Class: public class 8 Class: definition 9 Hello world 10 Method: main method: programs contain a main method 11 Method: main method: is public 12 Method: main method: is static 13 Method: main method: is void 14 Method: main method: is the program starting point 15 Command line arguments: program arguments are passed to main 16 Method: main method: always has the same heading 0-0
2 17 Hello world 18 Type: String: literal 19 Standard API: System: out.println() 20 Hello world 21 Statement 22 Statement: simple statements are ended with a semi-colon 23 Hello world 24 The full HelloWorld code 25 Trying it 26 Coursework: HelloWorld in French 27 Section 3: Example:Hello world with a syntactic error 28 Aim 29 Error 30 Error: syntactic error 33 Hello world with a syntactic error 34 Trying it 35 Type: String: literal: must be ended on the same line 36 Trying it 0-1
3 37 Coursework: Fortune syntactic errors 38 Section 4: Example:Hello world with a semantic error 39 Aim 40 Error: semantic error 42 Error: compile time error 43 Hello world with a semantic error 44 Trying it 45 Coursework: ManchesterWeather semantic errors 46 Section 5: Example:Hello solar system 47 Aim 48 Execution: sequential execution 49 Hello solar system 50 Trying it 51 Coursework: HelloFamily 52 Section 6: Example:Hello solar system with a run time error 53 Aim 54 Error: run time error 55 Hello solar system with a run time error 0-2
4 56 Trying it 57 Trying it 58 Trying it 59 Coursework: Quote run time errors 60 Section 7: Example:Hello anyone 61 Aim 62 Command line arguments: program arguments are accessed by inde 63 Type: String: concatenation 64 Hello anyone 65 Trying it 66 Trying it 67 Trying it 68 Trying it 69 Trying it 70 Coursework: FlatterMe 71 Section 8: Example:Hello anyone with a logical error 72 Aim 73 Error: logical error 0-3
5 74 Hello anyone with a logical error 75 Trying it 76 Coursework: Birthday logical errors 77 Section 9: Hello solar system, looking at the layout 78 Aim 79 Code clarity: layout 81 Hello solar system, looking at the layout 82 Code clarity: layout: indentation 84 Coursework: Limerick layout 85 Concepts covered in this chapter 0-4
6 Title Java Just in Time John Latham October 1, 2009 October 1, 2009 Java Just in Time - John Latham Page 1(0/0)
7 Chapter 2 Sequential execution and program errors October 1, 2009 Java Just in Time - John Latham Page 2(0/0)
8 Chapter aims Introduce some very basic Java concepts. Especially the idea of sequential execution. Look at the kinds of errors we can have in our programs. Because you will make errors! And you don t need to be afraid of them they are part of the programming experience! October 1, 2009 Java Just in Time - John Latham Page 3(0/0)
9 Section 2 Example: Hello world October 1, 2009 Java Just in Time - John Latham Page 4(0/0)
10 Aim AIM: To introduce some very basic Java concepts, including the main method and System.out.println(). October 1, 2009 Java Just in Time - John Latham Page 5(0/0)
11 Class: programs are divided into classes Program source text is separated into pieces called classes. Each piece is (usually) stored in a separate file. File name is the name of the class, with.java appended. E.g. HelloWorld in HelloWorld.java. One reason for dividing is to make management easier. A program might have thousands of lines. Another is to make sharing between programs easier. software reuse helps productivity. Every program has at least one class. Its name reflects the intention of the program. Convention: class names start with an upper case letter. October 1, 2009 Java Just in Time - John Latham Page 6(0/0)
12 Class: public class A class declared public can be accessed from anywhere in the running Java environment; in particular the virtual machine can access it. The source text starts with the reserved word public. A reserved word is part of the Java language. E.g. you cannot have a program called public. October 1, 2009 Java Just in Time - John Latham Page 7(0/0)
13 Class: definition After public we write the reserved word class, then its name, then a left brace ( ), its body of text and finally a closing right brace ( ). public class MyFabulousProgram... Lots of stuff here. October 1, 2009 Java Just in Time - John Latham Page 8(0/0)
14 Hello world The heading for our HelloWorld class. 001: public class HelloWorld Then we have the opening bracket. 002: October 1, 2009 Java Just in Time - John Latham Page 9(0/0)
15 Method: main method: programs contain a main method All Java programs contain a section of code called main. This is where the computer will start to execute the program. Sections of code are called methods they contain instructions on how to do something. The main method always starts with the following heading. public static void main(string[] args) October 1, 2009 Java Just in Time - John Latham Page 10(0/0)
16 Method: main method: is public The main method starts with the reserved word public. So the virtual machine has access to it. public October 1, 2009 Java Just in Time - John Latham Page 11(0/0)
17 Method: main method: is static The main method has the reserved word static. Thus it is allowed to be used in the static context. A context is an allocation of computer memory for the program and data, etc.. The virtual machine creates the static context when the program is loaded. A dynamic context is a kind of allocation of memory made during the run of the program. The main method must be able to run in the static context else the program could not be started! public static October 1, 2009 Java Just in Time - John Latham Page 12(0/0)
18 Method: main method: is void In general, a method might calculate and return some result, if so we state this in its heading. E.g. a method might calculate the square root of a number, and return the answer as a number. If it does not we write the reserved word void. Void means without contents. The main method does not return a value. public static void October 1, 2009 Java Just in Time - John Latham Page 13(0/0)
19 Method: main method: is the program starting point The program starting part main method is always called main. It is the main part of the program. public static void main October 1, 2009 Java Just in Time - John Latham Page 14(0/0)
20 Command line arguments: program arguments are passed to main Recall that programs can be given command line arguments. Java programs too can have arguments. Program arguments are a list of text strings. In Java, String[] means list of strings. We must give a name for this list, usually args. So we can refer to the given data from within the program if needed. public static void main(string[] args) October 1, 2009 Java Just in Time - John Latham Page 15(0/0)
21 Method: main method: always has the same heading Java program main methods always have a heading like this. public static void main(string[] args) Even if we do not intend to use command line arguments. So a typical single class program looks like the following. public class MyFabulousProgram public static void main(string[] args)... Stuff here to perform the task. October 1, 2009 Java Just in Time - John Latham Page 16(0/0)
22 Hello world Back to HelloWorld : public static void main(string[] args) 004: October 1, 2009 Java Just in Time - John Latham Page 17(0/0)
23 Type: String: literal A string literal is a fixed piece of text to be used as data. We enclose the text in double quotes. "This is a fixed piece of text data -- a string literal" This might be used as a message to the user. October 1, 2009 Java Just in Time - John Latham Page 18(0/0)
24 Standard API: System: out.println() The simplest way to print a message on standard output: System.out.println("This text will appear on standard output"); System is a class in Java s application program interface (API). Inside System there is a thing called out. This has a method called println. Overall it is called System.out.println. It takes a string in its brackets and displays it on the standard output. October 1, 2009 Java Just in Time - John Latham Page 19(0/0)
25 Hello world Back to HelloWorld : System.out.println("Hello world!"); Observe the semi-colon.... October 1, 2009 Java Just in Time - John Latham Page 20(0/0)
26 Statement A command that makes the computer perform a task is a statement. E.g. System.out.println("I will output whatever I am told to") October 1, 2009 Java Just in Time - John Latham Page 21(0/0)
27 Statement: simple statements are ended with a semi-colon All simple Java statements must be ended by a semi-colon. This is a rule of the Java language syntax. Coffee time: Can you think of a reason why Java insists on the programmer putting a semi-colon at the end of statements? October 1, 2009 Java Just in Time - John Latham Page 22(0/0)
28 Hello world Back to HelloWorld : 007: October 1, 2009 Java Just in Time - John Latham Page 23(0/0)
29 The full HelloWorld code 001: public class HelloWorld 002: 003: public static void main(string[] args) 004: 005: System.out.println("Hello world!"); 006: 007: October 1, 2009 Java Just in Time - John Latham Page 24(0/0)
30 Trying it We create the source code and compile it. $ ls -l HelloWorld.java Console Input / Output -rw jtl jtl 117 Apr 24 15:00 HelloWorld.java $ javac HelloWorld.java $ ls -l HelloWorld.* -rw jtl jtl 426 Apr 24 15:00 HelloWorld.class -rw jtl jtl 117 Apr 24 15:00 HelloWorld.java $ _ Run We run the program to get the message on its standard output. Console Input / Output $ java HelloWorld Hello world! $ _ Run October 1, 2009 Java Just in Time - John Latham Page 25(0/0)
31 Coursework: HelloWorld in French (Summary only) Write a program to greet the whole world, in French! October 1, 2009 Java Just in Time - John Latham Page 26(0/0)
32 Section 3 Example: Hello world with a syntactic error October 1, 2009 Java Just in Time - John Latham Page 27(0/0)
33 Aim AIM: To introduce the principle of program errors, in particular syntactic errors. We also see that a string literal must be ended on the same line its starts on. October 1, 2009 Java Just in Time - John Latham Page 28(0/0)
34 Error To err is Human.... when you write source code you will get somethings wrong. Lots of rules of Java to obey for a valid program. Being new to it you will break these rules. Even seasoned Java programmers make errors. October 1, 2009 Java Just in Time - John Latham Page 29(0/0)
35 Error: syntactic error When we break the syntax rules of Java we have a syntactic error. E.g. omitting a closing bracket, semi-colon.... Similar to grammatical error in natural language. E.g. sign strapped to the back of a poodle... October 1, 2009 Java Just in Time - John Latham Page 30(0/0)
36 Error: syntactic error My other dog an Alsatian. October 1, 2009 Java Just in Time - John Latham Page 31(0/0)
37 Error: syntactic error The compiler gives error messages for syntactic errors. Watch out: the compiler can get confused.... October 1, 2009 Java Just in Time - John Latham Page 32(0/0)
38 Hello world with a syntactic error 001: public class HelloWorld 002: 003: public static void main(string[] args) 004: 005: System.out.println("Hello world!); 006: 007: Coffee time: Can you spot the syntactic error? October 1, 2009 Java Just in Time - John Latham Page 33(0/0)
39 Trying it Console Input / Output $ javac HelloWorld.java HelloWorld.java:5: unclosed string literal System.out.println("Hello world!); ˆ 1 error $ _ Run Error messages from the compiler can look very daunting. Read carefully and observe the parts.... October 1, 2009 Java Just in Time - John Latham Page 34(0/0)
40 Type: String: literal: must be ended on the same line In Java, string literals must be ended on the same line they are started on. October 1, 2009 Java Just in Time - John Latham Page 35(0/0)
41 Trying it The compiler can get confused by bad code, but is getting better. Here is the Java 5.0 compiler processing the same program. Console Input / Output $ /usr/java/jdk1.5.0_04/bin/javac HelloWorld.java HelloWorld.java:5: unclosed string literal System.out.println("Hello world!); ˆ HelloWorld.java:6: ) expected ˆ 2 errors $ _ Run Coffee time: What has caused the second error message? October 1, 2009 Java Just in Time - John Latham Page 36(0/0)
42 Coursework: Fortune syntactic errors (Summary only) Take a given program that has syntactic errors in it, and get it working. October 1, 2009 Java Just in Time - John Latham Page 37(0/0)
43 Section 4 Example: Hello world with a semantic error October 1, 2009 Java Just in Time - John Latham Page 38(0/0)
44 Aim AIM: To introduce semantic errors and note that these and syntactic errors are compile time errors. October 1, 2009 Java Just in Time - John Latham Page 39(0/0)
45 Error: semantic error A semantic error we obey the syntax rules but we write something with no meaning (semantics). E.g. another sign, another poodle... October 1, 2009 Java Just in Time - John Latham Page 40(0/0)
46 Error: semantic error My other dog is a Porsche. October 1, 2009 Java Just in Time - John Latham Page 41(0/0)
47 Error: compile time error Java syntactic errors and semantic errors are detected by the compiler. Collectively called compile time errors. October 1, 2009 Java Just in Time - John Latham Page 42(0/0)
48 Hello world with a semantic error 001: public class HelloWorld 002: 003: public static void main(text[] args) 004: 005: System.out.println("Hello world!"); 006: 007: Coffee time: Can you spot the semantic error? October 1, 2009 Java Just in Time - John Latham Page 43(0/0)
49 Trying it $ javac HelloWorld.java Console Input / Output HelloWorld.java:3: cannot find symbol symbol : class Text location: class HelloWorld public static void main(text[] args) ˆ 1 error $ _ Run A little cryptic? Read carefully. You ll get used to it. October 1, 2009 Java Just in Time - John Latham Page 44(0/0)
50 Coursework: ManchesterWeather semantic errors (Summary only) Take a given program that has semantic errors in it, and get it working. October 1, 2009 Java Just in Time - John Latham Page 45(0/0)
51 Section 5 Example: Hello solar system October 1, 2009 Java Just in Time - John Latham Page 46(0/0)
52 Aim AIM: To introduce the principle of sequential execution. October 1, 2009 Java Just in Time - John Latham Page 47(0/0)
53 Execution: sequential execution Programs have many statements in a list. Usually placed on separate lines enhance human readability. Java doesn t care about layout we should. Statements in a list are executed one after the other. Actually the compiler turns each into byte codes. The virtual machine executes each collection of byte codes in turn. Known as sequential execution. October 1, 2009 Java Just in Time - John Latham Page 48(0/0)
54 Hello solar system 001: public class HelloSolarSystem 002: 003: public static void main(string[] args) 004: 005: System.out.println("Hello Mercury!"); 006: System.out.println("Hello Venus!"); 007: System.out.println("Hello Earth!"); 008: System.out.println("Hello Mars!"); 009: System.out.println("Hello Jupiter!"); 010: System.out.println("Hello Saturn!"); 011: System.out.println("Hello Uranus!"); 012: System.out.println("Hello Neptune!"); 013: System.out.println("Goodbye Pluto!"); 014: 015: October 1, 2009 Java Just in Time - John Latham Page 49(0/0)
55 Trying it Console Input / Output $ javac HelloSolarSystem.java $ java HelloSolarSystem Hello Mercury! Hello Venus! Hello Earth! Hello Mars! Hello Jupiter! Hello Saturn! Hello Uranus! Hello Neptune! Goodbye Pluto! $ _ Run October 1, 2009 Java Just in Time - John Latham Page 50(0/0)
56 Coursework: HelloFamily (Summary only) Write a program to greet some of your family. October 1, 2009 Java Just in Time - John Latham Page 51(0/0)
57 Section 6 Example: Hello solar system with a run time error October 1, 2009 Java Just in Time - John Latham Page 52(0/0)
58 Aim AIM: To introduce the principle of run time errors. October 1, 2009 Java Just in Time - John Latham Page 53(0/0)
59 Error: run time error Errors detected when the program is run are run time errors. Java calls them exceptions. Messages can look very cryptic? Read carefully, get used to them. E.g. Exception in thread "main" java.lang.nosuchmethoderror: main Best clue: look either side of the colon (:). October 1, 2009 Java Just in Time - John Latham Page 54(0/0)
60 Hello solar system with a run time error 001: public class HelloSolarSystem 002: 003: public static void Main(String[] args) 004: 005: System.out.println("Hello Mercury!"); 006: System.out.println("Hello Venus!"); 007: System.out.println("Hello Earth!"); 008: System.out.println("Hello Mars!"); 009: System.out.println("Hello Jupiter!"); 010: System.out.println("Hello Saturn!"); 011: System.out.println("Hello Uranus!"); 012: System.out.println("Hello Neptune!"); 013: System.out.println("Goodbye Pluto!"); 014: 015: Coffee time: What will cause a run time error? October 1, 2009 Java Just in Time - John Latham Page 55(0/0)
61 Trying it It compiles okay. Console Input / Output $ javac HelloSolarSystem.java $ _ Run But when we run it.... Console Input / Output $ java HelloSolarSystem Exception in thread "main" java.lang.nosuchmethoderror: main $ _ Run The virtual machine is telling us our program has no main method. We called it Main instead of main! October 1, 2009 Java Just in Time - John Latham Page 56(0/0)
62 Trying it Another example run time error. Console Input / Output $ java HelloMum Exception in thread "main" java.lang.noclassdeffounderror: HelloMum $ _ Run October 1, 2009 Java Just in Time - John Latham Page 57(0/0)
63 Trying it Coffee time: Imagine a version of HelloSolarSystem, called HelloSolarSystemNoArgs, with a lower case m on main, but String[] args has been omitted. Explain the following. Console Input / Output $ javac HelloSolarSystemNoArgs.java $ java HelloSolarSystemNoArgs Exception in thread "main" java.lang.nosuchmethoderror: main $ _ Run October 1, 2009 Java Just in Time - John Latham Page 58(0/0)
64 Coursework: Quote run time errors (Summary only) Take a given program that has run time errors in it, and get it working. October 1, 2009 Java Just in Time - John Latham Page 59(0/0)
65 Section 7 Example: Hello anyone October 1, 2009 Java Just in Time - John Latham Page 60(0/0)
66 Aim AIM: To introduce the principle of making Java programs perform a variation of their task based on command line arguments, which can be accessed via an index. We also meet string concatenation. October 1, 2009 Java Just in Time - John Latham Page 61(0/0)
67 Command line arguments: program arguments are accessed by index The command line arguments given to main method a list of strings from the command line. Each has an integer index, starting from zero. To access one we use its index in square brackets. E.g. args[0] is the first command line argument. October 1, 2009 Java Just in Time - John Latham Page 62(0/0)
68 Type: String: concatenation The + operator gives the concatenation of two strings. E.g. "Hello " + "world" has the same value as "Hello world". (Note where the space came from.) Most useful with one or more variable values. E.g. "Hello " + args[0] E.g. System.out.println("Hello " + args[0]) Coffee time: When might we concatenate two string literals? October 1, 2009 Java Just in Time - John Latham Page 63(0/0)
69 Hello anyone 001: public class HelloAnyone 002: 003: public static void main(string[] args) 004: 005: System.out.println("Hello " + args[0]); 006: 007: October 1, 2009 Java Just in Time - John Latham Page 64(0/0)
70 Trying it Console Input / Output $ javac HelloAnyone.java $ java HelloAnyone John Hello John $ java HelloAnyone Lizzy Hello Lizzy $ _ Run What if no argument? Console Input / Output $ java HelloAnyone Exception in thread "main" java.lang.arrayindexoutofboundsexception: 0 at HelloAnyone.main(HelloAnyone.java:5) $ _ Run Observe source name and line number. October 1, 2009 Java Just in Time - John Latham Page 65(0/0)
71 Trying it What if name contains a space? Console Input / Output $ java HelloAnyone "John Latham" Hello John Latham $ java HelloAnyone John Latham Hello John $ _ Run What about empty string? Console Input / Output $ java HelloAnyone "" Hello $ _ Run October 1, 2009 Java Just in Time - John Latham Page 66(0/0)
72 Trying it D:\JJIT\Example 2.7>dir HelloAnyone.java Volume in drive D is DATA Volume Serial Number is 5C90 0C33 Directory of D:\JJIT\Example /04/ : HelloAnyone.java 1 File(s) 130 bytes 0 Dirs(s) 8,389,459,968 bytes free D:\JJIT\Example 2.7>javac HelloAnyone.java D:\JJIT\Example 2.7>dir HelloAnyone.* Volume in drive D is DATA Volume Serial Number is 5C90 0C33 Directory of D:\JJIT\Example /04/ : HelloAnyone.java 24/04/ : HelloAnyone.class 2 File(s) 716 bytes 0 Dirs(s) 8,389,459,968 bytes free D:\JJIT\Example 2.7>java HelloAnyone "John Latham" Hello John Latham D:\JJIT\Example 2.7>_ October 1, 2009 Java Just in Time - John Latham Page 67(0/0)
73 Trying it October 1, 2009 Java Just in Time - John Latham Page 68(0/0)
74 Trying it October 1, 2009 Java Just in Time - John Latham Page 69(0/0)
75 Coursework: FlatterMe (Summary only) Write a program to say how wonderful the user is. October 1, 2009 Java Just in Time - John Latham Page 70(0/0)
76 Section 8 Example: Hello anyone with a logical error October 1, 2009 Java Just in Time - John Latham Page 71(0/0)
77 Aim AIM: To introduce the principle of logical errors. October 1, 2009 Java Just in Time - John Latham Page 72(0/0)
78 Error: logical error Most tricky kind of error a logical error. No help from compiler, nor virtual machine. Code is meaningful to Java. But program does not do what we wanted. Java is too stupid to know that. Subtles ones slip through our testing. They become bugs. October 1, 2009 Java Just in Time - John Latham Page 73(0/0)
79 Hello anyone with a logical error 001: public class HelloAnyone 002: 003: public static void main(string[] args) 004: 005: System.out.println("Hello + args[0]"); 006: 007: Coffee time: Can you spot the logical error? October 1, 2009 Java Just in Time - John Latham Page 74(0/0)
80 Trying it It compiles and runs without error. Console Input / Output $ javac HelloAnyone.java $ java HelloAnyone John Hello + args[0] $ _ Run October 1, 2009 Java Just in Time - John Latham Page 75(0/0)
81 Coursework: Birthday logical errors (Summary only) Take a given program that has logical errors in it, and get it working. October 1, 2009 Java Just in Time - John Latham Page 76(0/0)
82 Section 9 Hello solar system, looking at the layout October 1, 2009 Java Just in Time - John Latham Page 77(0/0)
83 Aim AIM: To begin to explore the decisions behind the way we lay out the source code for a program. October 1, 2009 Java Just in Time - John Latham Page 78(0/0)
84 Code clarity: layout Java doesn t care about layout white space must separate symbols that would be one symbol otherwise. E.g. public void would be publicvoid. Could put program on one line, minimum space. public class HelloSolarSystem Or split just to fit on page. public static void main(string[]args) System.out.println("Hello Mercu public class HelloSolarSystem public static void main(string[]args) System.out.println("Hello Mercury!");System.out.println( "Hello Venus!");System.out.println("Hello Earth!");System.out.println ("Hello Mars!");System.out.println("Hello Jupiter!");System.out. println("hello Saturn!");System.out.println("Hello Uranus!");System. out.println("hello Neptune!");System.out.println("Goodbye Pluto!"); October 1, 2009 Java Just in Time - John Latham Page 79(0/0)
85 Code clarity: layout Layout is important for the human reader. Take pride in making your work most readable. Split lines in good places. Use indentation to show structure. October 1, 2009 Java Just in Time - John Latham Page 80(0/0)
86 Hello solar system, looking at the layout 001: public class HelloSolarSystem 002: 003: public static void main(string[] args) 004: 005: System.out.println("Hello Mercury!"); 006: System.out.println("Hello Venus!"); 007: System.out.println("Hello Earth!"); 008: System.out.println("Hello Mars!"); 009: System.out.println("Hello Jupiter!"); 010: System.out.println("Hello Saturn!"); 011: System.out.println("Hello Uranus!"); 012: System.out.println("Hello Neptune!"); 013: System.out.println("Goodbye Pluto!"); 014: 015: New line after class heading. New line plus indentation 2 or 3 spaces for main method. New line, same indentation. More indentation, each statement on own line. Line up with opening braces. October 1, 2009 Java Just in Time - John Latham Page 81(0/0)
87 Code clarity: layout: indentation A class contains nested structures. The class has heading and body. The body has main method. Main method has heading and body. Use indentation to show structure. The more nested, the more space. Be consistent: always same number of spaces per nesting. Two or three is good. Don t use tabs! Opening and closing braces have same indentation. October 1, 2009 Java Just in Time - John Latham Page 82(0/0)
88 Code clarity: layout: indentation Some people prefer this style subjectively less clear? public class HelloWorld public static void main(string[] args) System.out.println("Hello world!"); October 1, 2009 Java Just in Time - John Latham Page 83(0/0)
89 Coursework: Limerick layout (Summary only) Take a given program and lay it out properly. October 1, 2009 Java Just in Time - John Latham Page 84(0/0)
90 Concepts covered in this chapter Each book chapter ends with a list of concepts covered in it. Each concept has with it a self-test question, and a page reference to where it was covered. Please use these to check your understanding before we start the next chapter. October 1, 2009 Java Just in Time - John Latham Page 85(0/0)
17 Hello world 18 Type: String: literal 19 Standard API: System: out.println() 20 Hello world 21 Statement 22 Statement: simple statements are ended w
List of Slides 1 Title 2 Chapter 2: Sequential execution and program errors 3 Chapter aims 4 Section 2: Example:Hello world 5 Aim 6 Class: programs are divided into classes 7 Class: public class 8 Class:
More information17 Statement: assignment statement: assigning an expression value 18 Age next year 19 Type: String: conversion: from int 21 Age next year 22 The full
List of Slides 1 Title 2 Chapter 3: Types, variables and expressions 3 Chapter aims 4 Section 2: Example:Age next year 5 Aim 6 Design: hard coding 7 Age next year 8 Type 9 Type: int 10 Variable 11 Variable:
More informationA PROGRAM IS A SEQUENCE of instructions that a computer can execute to
A PROGRAM IS A SEQUENCE of instructions that a computer can execute to perform some task. A simple enough idea, but for the computer to make any use of the instructions, they must be written in a form
More informationIntroduction to Java. Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords
Introduction to Java Java Programs Classes, Methods, and Statements Comments Strings Escape Sequences Identifiers Keywords Program Errors Syntax Runtime Logic Procedural Decomposition Methods Flow of Control
More informationCS 177 Recitation. Week 1 Intro to Java
CS 177 Recitation Week 1 Intro to Java Questions? Computers Computers can do really complex stuff. How? By manipulating data according to lists of instructions. Fundamentally, this is all that a computer
More informationJava Bytecode (binary file)
Java is Compiled Unlike Python, which is an interpreted langauge, Java code is compiled. In Java, a compiler reads in a Java source file (the code that we write), and it translates that code into bytecode.
More informationMobile App:IT. Methods & Classes
Mobile App:IT Methods & Classes WHAT IS A METHOD? - A method is a set of code which is referred to by name and can be called (invoked) at any point in a program simply by utilizing the method's name. -
More informationClass 1: Homework. Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017
Intro to Computer Science CSCI-UA.0101 New York University Courant Institute of Mathematical Sciences Fall 2017 1 1. Please obtain a copy of Introduction to Java Programming, 11th (or 10th) Edition, Brief
More information17 GUI API: Container 18 Hello world with a GUI 19 GUI API: JLabel 20 GUI API: Container: add() 21 Hello world with a GUI 22 GUI API: JFrame: setdefau
List of Slides 1 Title 2 Chapter 13: Graphical user interfaces 3 Chapter aims 4 Section 2: Example:Hello world with a GUI 5 Aim 6 Hello world with a GUI 7 Hello world with a GUI 8 Package: java.awt and
More informationCS125 : Introduction to Computer Science. Lecture Notes #4 Type Checking, Input/Output, and Programming Style
CS125 : Introduction to Computer Science Lecture Notes #4 Type Checking, Input/Output, and Programming Style c 2005, 2004, 2002, 2001, 2000 Jason Zych 1 Lecture 4 : Type Checking, Input/Output, and Programming
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 3: SEP. 13TH INSTRUCTOR: JIAYIN WANG 1 Notice Reading Assignment Chapter 1: Introduction to Java Programming Homework 1 It is due this coming Sunday
More informationLab # 2. For today s lab:
1 ITI 1120 Lab # 2 Contributors: G. Arbez, M. Eid, D. Inkpen, A. Williams, D. Amyot 1 For today s lab: Go the course webpage Follow the links to the lab notes for Lab 2. Save all the java programs you
More informationChapter Two Bonus Lesson: JavaDoc
We ve already talked about adding simple comments to your source code. The JDK actually supports more meaningful comments as well. If you add specially-formatted comments, you can then use a tool called
More informationLecture 2. COMP1406/1006 (the Java course) Fall M. Jason Hinek Carleton University
Lecture 2 COMP1406/1006 (the Java course) Fall 2013 M. Jason Hinek Carleton University today s agenda a quick look back (last Thursday) assignment 0 is posted and is due this Friday at 2pm Java compiling
More informationCOSC 123 Computer Creativity. Introduction to Java. Dr. Ramon Lawrence University of British Columbia Okanagan
COSC 123 Computer Creativity Introduction to Java Dr. Ramon Lawrence University of British Columbia Okanagan ramon.lawrence@ubc.ca Key Points 1) Introduce Java, a general-purpose programming language,
More informationProgram Development. Program Development. A Foundation for Programming. Program Development
Program Development Program Development Ada Lovelace Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2008 February 11, 2010 8:48 AM 2 A Foundation
More informationProgramming with Java
Programming with Java Variables and Output Statement Lecture 03 First stage Software Engineering Dep. Saman M. Omer 2017-2018 Objectives ü Declare and assign values to variable ü How to use eclipse ü What
More informationCS 152: Data Structures with Java Hello World with the IntelliJ IDE
CS 152: 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: Electrical and Computer Engineering building
More informationLesson 04: Our First Java Program (W01D4
Lesson 04: Our First Java Program (W01D4) Balboa High School Michael Ferraro Lesson 04: Our First Java Program (W01D4 Do Now Start a terminal shell. From there, issue these commands
More informationLecture Notes CPSC 224 (Spring 2012) Today... Java basics. S. Bowers 1 of 8
Today... Java basics S. Bowers 1 of 8 Java main method (cont.) In Java, main looks like this: public class HelloWorld { public static void main(string[] args) { System.out.println("Hello World!"); Q: How
More informationIntroduction Basic elements of Java
Software and Programming I Introduction Basic elements of Java Roman Kontchakov / Carsten Fuhs Birkbeck, University of London Module Information Time: Thursdays in the Spring term Lectures: MAL B04: 2
More informationJava Foundations: Unit 3. Parts of a Java Program
Java Foundations: Unit 3 Parts of a Java Program class + name public class HelloWorld public static void main( String[] args ) System.out.println( Hello world! ); A class creates a new type, something
More informationInf1-OP. Course Overview. Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein. February 26, School of Informatics
Inf1-OP Course Overview Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein School of Informatics February 26, 2018 Administrative Stuff Who to contact for help? Lecturer: Volker
More informationWho and what can help? Inf1-OP. Lecturer: Timothy Hospedales TA: Natalia Zon
Who and what can help? Inf1-OP Lecturer: Timothy Hospedales TA: Natalia Zon Course Overview Web: http://www.inf.ed.ac.uk/teaching/ courses/inf1/op/ Timothy Hospedales, adapting earlier version by Perdita
More information40 Absolute difference 42 Trying it 43 Trying it 44 Concepts covered in this chapter 0-2
List of Slides 1 Title 2 Chapter 4: Conditional execution 3 Chapter aims 4 Section 2: Example:Oldest spouse 1 5 Aim 6 Execution: conditional execution 7 Expression: boolean 8 Expression: boolean: relational
More informationAn overview of Java, Data types and variables
An overview of Java, Data types and variables Lecture 2 from (UNIT IV) Prepared by Mrs. K.M. Sanghavi 1 2 Hello World // HelloWorld.java: Hello World program import java.lang.*; class HelloWorld { public
More informationJava Just in Time: task questions
Java Just in Time: task questions John Latham October 24, 2017 Contents 1 Chapter 1 Introduction 4 1.6 Section / task 1.6 Our first Java program..................... 4 1.7 Section / task 1.7 Our second
More informationBasic Programming Language Syntax
Java Created in 1990 by Sun Microsystems. Free compiler from Sun, commercial from many vendors. We use free (Sun) Java on UNIX. Compiling and Interpreting...are processes of translating a high-level programming
More informationComputer Hardware. Java Software Solutions Lewis & Loftus. Key Hardware Components 12/17/2013
Java Software Solutions Lewis & Loftus Chapter 1 Notes Computer Hardware Key Hardware Components CPU central processing unit Input / Output devices Main memory (RAM) Secondary storage devices: Hard drive
More informationProgramming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur
Programming in Java Prof. Debasis Samanta Department of Computer Science Engineering Indian Institute of Technology, Kharagpur Lecture 04 Demonstration 1 So, we have learned about how to run Java programs
More informationTitle. Java Just in Time. John Latham. October 25, October 25, 2017 Java Just in Time - John Latham Page 1(0/0)
List of Slides 1 Title 2 Chapter 6: Control statements nested in loops 3 Chapter aims 4 Section 2: Example:Film certificate age checking the whole queue 5 Aim 6 Statement: statements can be nested within
More informationGet JAVA. I will just tell you what I did (on January 10, 2017). I went to:
Get JAVA To compile programs you need the JDK (Java Development Kit). To RUN programs you need the JRE (Java Runtime Environment). This download will get BOTH of them, so that you will be able to both
More informationCONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics. COMP-202 Unit 1: Introduction
CONTENTS: What Is Programming? How a Computer Works Programming Languages Java Basics COMP-202 Unit 1: Introduction Announcements Did you miss the first lecture? Come talk to me after class. If you want
More informationProgram Fundamentals
Program Fundamentals /* HelloWorld.java * The classic Hello, world! program */ class HelloWorld { public static void main (String[ ] args) { System.out.println( Hello, world! ); } } /* HelloWorld.java
More informationWelcome to CSE 142! Zorah Fung University of Washington, Spring Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs
Welcome to CSE 142! Zorah Fung University of Washington, Spring 2015 Building Java Programs Chapter 1 Lecture 1: Introduction; Basic Java Programs reading: 1.1-1.3 1 What is computer science? computers?
More information3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS)
GETTING STARTED: YOUR FIRST JAVA APPLICATION 15 3 CREATING YOUR FIRST JAVA APPLICATION (USING WINDOWS) GETTING STARTED: YOUR FIRST JAVA APPLICATION Checklist: The most recent version of Java SE Development
More informationCOMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016
COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2016 Learn about cutting-edge research over lunch with cool profs January 18-22, 2015 11:30
More informationGetting Started with Java. Atul Prakash
Getting Started with Java Atul Prakash Running Programs C++, Fortran, Pascal Python, PHP, Ruby, Perl Java is compiled into device-independent code and then interpreted Source code (.java) is compiled into
More informationCS 11 java track: lecture 1
CS 11 java track: lecture 1 Administrivia need a CS cluster account http://www.cs.caltech.edu/ cgi-bin/sysadmin/account_request.cgi need to know UNIX www.its.caltech.edu/its/facilities/labsclusters/ unix/unixtutorial.shtml
More informationWelcome to CSE 142! Whitaker Brand. University of Washington, Winter 2018
Welcome to CSE 142! Whitaker Brand University of Washington, Winter 2018 1 What is computer science? computers? science? programming? late lonely nights in front of the computer? ALGORITHMIC THINKING al
More informationInf1-OOP. Textbooks. Who and What. Organisational issues. Why Java? Course Overview. Hello, World! in Java
Organisational issues Inf1-OOP Course Overview Perdita Stevens, adapting earlier version by Ewan Klein School of Informatics January 11, 2014 Why Java? Hello, World! in Java Built-in Types Integers Floating-Point
More informationCode Ninjas: Introduction to Computer Science. Macomb Science Olympiad Presented by Swati Dharia
Code Ninjas: Introduction to Computer Science Macomb Science Olympiad Presented by Swati Dharia Intro to Java Programming The three basic steps required to get a simple program running. As with any application,
More informationBIT Java Programming. Sem 1 Session 2011/12. Chapter 2 JAVA. basic
BIT 3383 Java Programming Sem 1 Session 2011/12 Chapter 2 JAVA basic Objective: After this lesson, you should be able to: declare, initialize and use variables according to Java programming language guidelines
More informationCOMP-202: Foundations of Programming. Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015
COMP-202: Foundations of Programming Lecture 2: Variables, and Data Types Sandeep Manjanna, Summer 2015 Announcements Midterm Exams on 4 th of June (12:35 14:35) Room allocation will be announced soon
More informationHow to make a "hello world" program in Java with Eclipse *
OpenStax-CNX module: m43473 1 How to make a "hello world" program in Java with Eclipse * Hannes Hirzel Based on How to make a "hello world" program in Java. by Rodrigo Rodriguez This work is produced by
More informationCreating a Program in JCreator. JCreator is then used to create our program. But the first step is to create a new file.
First Program (02) Creating a Java program and understanding the basic concepts. Creating a Program in JCreator It is usually a good idea to create a folder where you re going to save your Java programs.
More informationLec 3. Compilers, Debugging, Hello World, and Variables
Lec 3 Compilers, Debugging, Hello World, and Variables Announcements First book reading due tonight at midnight Complete 80% of all activities to get 100% HW1 due Saturday at midnight Lab hours posted
More informationTitle. Java Just in Time. John Latham. November 5, November 5, 2018 Java Just in Time - John Latham Page 1(0/0)
List of Slides 1 Title 2 Chapter 9: Consolidation of concepts so far 3 Chapter aims 4 Section 2: Java concepts 5 Aim 6 Java concepts 7 Type: long 8 Type: short 9 Type: byte 10 Type: char 11 Type: char:
More informationCOMP-202: Foundations of Programming. Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015
COMP-202: Foundations of Programming Lecture 2: Java basics and our first Java program! Jackie Cheung, Winter 2015 Assignment Due Date Assignment 1 is now due on Tuesday, Jan 20 th, 11:59pm. Quiz 1 is
More informationInf1-OOP. Textbooks. Who and What. Organizational Issues. Why Java? Course Overview. Hello, World! in Java. Ewan Klein, Perdita Stevens
Organizational Issues Inf1-OOP Course Overview Ewan Klein, Perdita Stevens School of Informatics January 12, 2013 Why Java? Hello, World! in Java Built-in Types Integers Floating-Point Numbers Type Conversion
More information1 Introduction Java, the beginning Java Virtual Machine A First Program BlueJ Raspberry Pi...
Contents 1 Introduction 3 1.1 Java, the beginning.......................... 3 1.2 Java Virtual Machine........................ 4 1.3 A First Program........................... 4 1.4 BlueJ.................................
More informationC02: Overview of Software Development and Java
CISC 3120 C02: Overview of Software Development and Java Hui Chen Department of Computer & Information Science CUNY Brooklyn College 08/31/2017 CUNY Brooklyn College 1 Outline Recap and issues Brief introduction
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 17 January 2019 SP1-Lab1-2018-19.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More informationCS 231 Data Structures and Algorithms, Fall 2016
CS 231 Data Structures and Algorithms, Fall 2016 Dr. Bruce A. Maxwell Department of Computer Science Colby College Course Description Focuses on the common structures used to store data and the standard
More informationAdministrative Stuff. Inf1-OP. Additional help? Who to contact for help? Course Overview
nf1-op Course Overview Volker Seeker, adapting earlier version by Perdita Stevens and Ewan Klein Administrative Stuff School of nformatics February 26, 2018 Who to contact for help? Additional help? Lecturer:
More informationPace University. Fundamental Concepts of CS121 1
Pace University Fundamental Concepts of CS121 1 Dr. Lixin Tao http://csis.pace.edu/~lixin Computer Science Department Pace University October 12, 2005 This document complements my tutorial Introduction
More informationBuilding Java Programs. Introduction to Programming and Simple Java Programs
Building Java Programs Introduction to Programming and Simple Java Programs 1 A simple Java program public class Hello { public static void main(string[] args) { System.out.println("Hello, world!"); code
More informationOutline. Overview. Control statements. Classes and methods. history and advantage how to: program, compile and execute 8 data types 3 types of errors
Outline Overview history and advantage how to: program, compile and execute 8 data types 3 types of errors Control statements Selection and repetition statements Classes and methods methods... 2 Oak A
More informationCOMP 110 Project 1 Programming Project Warm-Up Exercise
COMP 110 Project 1 Programming Project Warm-Up Exercise Creating Java Source Files Over the semester, several text editors will be suggested for students to try out. Initially, I suggest you use JGrasp,
More informationRepe$$on CSC 121 Fall 2015 Howard Rosenthal
Repe$$on CSC 121 Fall 2015 Howard Rosenthal Lesson Goals Learn the following three repetition methods, their similarities and differences, and how to avoid common errors when using them: while do-while
More informationCSE 142 Su 04 Computer Programming 1 - Java. Objects
Objects Objects have state and behavior. State is maintained in instance variables which live as long as the object does. Behavior is implemented in methods, which can be called by other objects to request
More informationChapter 2 Author Notes
Chapter 2 Author Notes Good Programming Practice 2.1 Every program should begin with a comment that explains the purpose of the program, the author and the date and time the program was last modified.
More informationGoals. Java - An Introduction. Java is Compiled and Interpreted. Architecture Neutral & Portable. Compiled Languages. Introduction to Java
Goals Understand the basics of Java. Introduction to Java Write simple Java Programs. 1 2 Java - An Introduction Java is Compiled and Interpreted Java - The programming language from Sun Microsystems Programmer
More informationArrays. Lecture 9 COP 3014 Fall October 16, 2017
Arrays Lecture 9 COP 3014 Fall 2017 October 16, 2017 Array Definition An array is an indexed collection of data elements of the same type. Indexed means that the array elements are numbered (starting at
More information12/22/11. Java How to Program, 9/e. Help you get started with Eclipse and NetBeans integrated development environments.
Java How to Program, 9/e Education, Inc. All Rights Reserved. } Java application programming } Use tools from the JDK to compile and run programs. } Videos at www.deitel.com/books/jhtp9/ Help you get started
More informationThe compiler is spewing error messages.
Appendix B Debugging There are a few different kinds of errors that can occur in a program, and it is useful to distinguish between them in order to track them down more quickly. Compile-time errors are
More informationJava: Comment Text. Introduction. Concepts
Java: Comment Text Introduction Comment text is text included in source code that is ignored by the compiler and does not cause any machine-language object code to be generated. It is written into the
More informationChapter 1. Introduction
Chapter 1 Introduction Chapter Scope Introduce the Java programming language Program compilation and execution Problem solving in general The software development process Overview of object-oriented principles
More informationCSC116: Introduction to Computing - Java
CSC116: Introduction to Computing - Java Course Information Introductions Website Syllabus Computers First Java Program Text Editor Helpful Commands Java Download Intro to CSC116 Instructors Course Instructor:
More informationG52PGP. Lecture oo3 Java (A real object oriented language)
G52PGP Lecture oo3 Java (A real object oriented language) 1 Last lecture Associating functions with data into objects is an alternative way to decompose a program Can then consider each object on its own
More informationWentworth Institute of Technology. Engineering & Technology WIT COMP1000. Java Basics
WIT COMP1000 Java Basics Java Origins Java was developed by James Gosling at Sun Microsystems in the early 1990s It was derived largely from the C++ programming language with several enhancements Java
More informationCSE 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 EggBasketEnhanced { public static void main(string[]
More informationJava Programming Fundamentals - Day Instructor: Jason Yoon Website:
Java Programming Fundamentals - Day 1 07.09.2016 Instructor: Jason Yoon Website: http://mryoon.weebly.com Quick Advice Before We Get Started Java is not the same as javascript! Don t get them confused
More informationCS11 Java. Fall Lecture 1
CS11 Java Fall 2006-2007 Lecture 1 Welcome! 8 Lectures Slides posted on CS11 website http://www.cs.caltech.edu/courses/cs11 7-8 Lab Assignments Made available on Mondays Due one week later Monday, 12 noon
More informationCS 251 Intermediate Programming Java Basics
CS 251 Intermediate Programming Java Basics Brooke Chenoweth University of New Mexico Spring 2018 Prerequisites These are the topics that I assume that you have already seen: Variables Boolean expressions
More informationCOMP-202 Unit 2: Java Basics. CONTENTS: Using Expressions and Variables Types Strings Methods
COMP-202 Unit 2: Java Basics CONTENTS: Using Expressions and Variables Types Strings Methods Assignment 1 Assignment 1 posted on WebCt and course website. It is due May 18th st at 23:30 Worth 6% Part programming,
More informationTOPIC 2 INTRODUCTION TO JAVA AND DR JAVA
1 TOPIC 2 INTRODUCTION TO JAVA AND DR JAVA Notes adapted from Introduction to Computing and Programming with Java: A Multimedia Approach by M. Guzdial and B. Ericson, and instructor materials prepared
More informationArray Basics: Outline. Creating and Accessing Arrays. Creating and Accessing Arrays. Arrays (Savitch, Chapter 7)
Array Basics: Outline Arrays (Savitch, Chapter 7) TOPICS Array Basics Arrays in Classes and Methods Programming with Arrays Searching and Sorting Arrays Multi-Dimensional Arrays Static Variables and Constants
More information1B1a Programming I Getting Started
1B1a Programming I Getting Started Agenda Definitions. What is programming? What is Java? Writing your first program. Classes and Objects. 1 2 Reading You should be reading chapters 1 & 2 of the text book.
More informationCS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 8: SEP. 29TH INSTRUCTOR: JIAYIN WANG
CS/IT 114 Introduction to Java, Part 1 FALL 2016 CLASS 8: SEP. 29TH INSTRUCTOR: JIAYIN WANG 1 Notice Prepare the Weekly Quiz The weekly quiz is for the knowledge we learned in the previous week (both the
More informationInterpreted vs Compiled. Java Compile. Classes, Objects, and Methods. Hello World 10/6/2016. Python Interpreted. Java Compiled
Interpreted vs Compiled Python 1 Java Interpreted Easy to run and test Quicker prototyping Program runs slower Compiled Execution time faster Virtual Machine compiled code portable Java Compile > javac
More informationChapter 2: Programming Concepts
Chapter 2: Programming Concepts Objectives Students should Know the steps required to create programs using a programming language and related terminology. Be familiar with the basic structure of a Java
More information1007 Imperative Programming Part II
Agenda 1007 Imperative Programming Part II We ve seen the basic ideas of sequence, iteration and selection. Now let s look at what else we need to start writing useful programs. Details now start to be
More informationCMSC 150 LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE HELLO WORLD
CMSC 150 INTRODUCTION TO COMPUTING ACKNOWLEDGEMENT: THESE SLIDES ARE ADAPTED FROM SLIDES PROVIDED WITH INTRODUCTION TO JAVA PROGRAMMING, LIANG (PEARSON 2014) LECTURE 1 INTRODUCTION TO COURSE COMPUTER SCIENCE
More informationGetting started with Java
Getting started with Java by Vlad Costel Ungureanu for Learn Stuff Programming Languages A programming language is a formal constructed language designed to communicate instructions to a machine, particularly
More informationReview Chapters 1 to 4. Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013
Review Chapters 1 to 4 Instructor: Scott Kristjanson CMPT 125/125 SFU Burnaby, Fall 2013 Introduction to Java Chapters 1 and 2 The Java Language Section 1.1 Data & Expressions Sections 2.1 2.5 Instructor:
More informationDepartment of Computer Science University of Pretoria. Introduction to Computer Science COS 151
Department of Computer Science University of Pretoria Introduction to Computer Science COS 151 Practical 1 16 February 2018 1 Plagiarism Policy The Department of Computer Science considers plagiarism as
More informationA Foundation for Programming
Program Development Introduction to Programming in Java: An Interdisciplinary Approach Robert Sedgewick and Kevin Wayne Copyright 2002 2010 2/17/11 7:35 AM! A Foundation for Programming any program you
More informationCS 106 Introduction to Computer Science I
CS 106 Introduction to Computer Science I 05 / 31 / 2017 Instructor: Michael Eckmann Today s Topics Questions / Comments? recap and some more details about variables, and if / else statements do lab work
More informationFirst Java Program - Output to the Screen
First Java Program - Output to the Screen These notes are written assuming that the reader has never programmed in Java, but has programmed in another language in the past. In any language, one of the
More informationPrograms, Statements, Variables
Programs, Statements, Variables Wolfgang Schreiner Research Institute for Symbolic Computation (RISC) Johannes Kepler University, Linz, Austria Wolfgang.Schreiner@risc.jku.at http://www.risc.jku.at Wolfgang
More informationIntro to Programming. Unit 7. What is Programming? What is Programming? Intro to Programming
Intro to Programming Unit 7 Intro to Programming 1 What is Programming? 1. Programming Languages 2. Markup vs. Programming 1. Introduction 2. Print Statement 3. Strings 4. Types and Values 5. Math Externals
More information1. Download the JDK 6, from
1. Install the JDK 1. Download the JDK 6, from http://java.sun.com/javase/downloads/widget/jdk6.jsp. 2. Once the file is completed downloaded, execute it and accept the license agreement. 3. Select the
More informationOutline. CIS 110: Introduction to Computer Programming. What is Computer Science? What is computer programming? What is computer science?
Outline CIS 110: Introduction to Computer Programming Lecture 1 An introduction of an introduction ( 1.1 1.3)* 1. What is computer science and computer programming? 2. Introductions and logistics 3. The
More informationProgramming Language Concepts: Lecture 2
Programming Language Concepts: Lecture 2 Madhavan Mukund Chennai Mathematical Institute madhavan@cmi.ac.in http://www.cmi.ac.in/~madhavan/courses/pl2011 PLC 2011, Lecture 2, 6 January 2011 Classes and
More informationCourse Outline. Introduction to java
Course Outline 1. Introduction to OO programming 2. Language Basics Syntax and Semantics 3. Algorithms, stepwise refinements. 4. Quiz/Assignment ( 5. Repetitions (for loops) 6. Writing simple classes 7.
More informationFull file at
Java Programming: From Problem Analysis to Program Design, 3 rd Edition 2-1 Chapter 2 Basic Elements of Java At a Glance Instructor s Manual Table of Contents Overview Objectives s Quick Quizzes Class
More informationBASIC COMPUTATION. public static void main(string [] args) Fundamentals of Computer Science I
BASIC COMPUTATION x public static void main(string [] args) Fundamentals of Computer Science I Outline Using Eclipse Data Types Variables Primitive and Class Data Types Expressions Declaration Assignment
More information5/3/2006. Today! HelloWorld in BlueJ. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont. HelloWorld in BlueJ, Cont.
Today! Build HelloWorld yourself in BlueJ and Eclipse. Look at all the Java keywords. Primitive Types. HelloWorld in BlueJ 1. Find BlueJ in the start menu, but start the Select VM program instead (you
More informationSoftware and Programming 1
Software and Programming 1 Lab 1: Introduction, HelloWorld Program and use of the Debugger 11 January 2018 SP1-Lab1-2017-18.pptx Tobi Brodie (tobi@dcs.bbk.ac.uk) 1 Module Information Lectures: Afternoon
More information