Java
What is a string?
Any text enclosed with quotation marks, it will print the exact text written, for example "Hello, World!"
What are the three essential elements of pseudo-code?
Computation: total cost = price + interest Decision: If total cost 1 < total cost 2 Repetition: while balance < 10,000 repeat 10 times
What is the variable type? String greeting = "Hello, World!";
String: variable type greeting: variable name "Hello, World!"; : initial variable value
What is the difference between: System.out.print(______); System.out.println(_____);
System.out.print will print the output and then keep the cursor at the end of that output. System.out.println will print the output and then move the cursor to the next line.
What is an object?
a building block of a program, a component with some desired functionality, can be constructed or pre-made.
What is a class?
a group of objects that have common behavior, for example 3 different dates would be grouped together in this
What must be put at the end of each line of code?
a semi colon ;
What does this object do? System.out.
It is the standard output stream. It opens a new window to display outputs.
What is a compile-time error?
An error that is found when you compile the program. It means you are not following the rules of the programming language.
What are the three characteristics of an Algorithm?
Unambiguous, can only be interpreted in only one way. Executable, steps that a computer can carry out. Terminating, that the steps come to an end.
What is pseudo-code?
A combination of English and math, a way programmers think through developing code or algorithms before actually in the actual programming language.
What is Java?
A programming language that enables you to write instructions to tell a computer what to do.
What are the two ways to execute a program in java?
Either System.out.print(insert calculation); System.out.println(insert calculation);
What does the variable int mean?
Integer, a number positive or negative without fractional parts
What is another name for a run-time error?
Logic error
What is the variable type? Picture rocket = new Picture("mariner4.jpg");
Picture: variable type rocket: variable name = : assignment new: make new object Picture: class "mariner4.jpg": construct arguments (actual pic that you are loading)
What is another name for a compile-time error?
Syntax error
What does it mean to compile a code?
The compiler translates the code from java language to machine language, 1's and 0's
What does a shaded icon in bluej mean?
The program has not been compiled successfully
How do you input a comment into java?
Two slash marks "//" then typing the comment.
What is the variable type, name, and initial value? What does the initial value mean? Day sallyRidesBirthday = new Day(1951, 5, 26);
Variable Type: Day Variable Name: sallyRidesBirthday Variable Initial Value: = new Day(1951, 5, 26); It means we create a new day object with the date 5/26/1951
What is the variable type, name, and initial value? double rocketSpeed = 24724.573
Variable Type: double Variable Name: rocketSpeed Variable Initial Value: 24724.573
What is the variable type, name, and initial value? int mannedMoonLandings = 6;
Variable Type: int Variable Name: mannedMoonLandings Variable Initial Value: 6
Why was Java made?
When a computer runs a program it puts everything into 1's and 0's. It would be difficult for us to write code like that, so we use programming language like java that the computer can translate into 1's and 0's. Java itself was made to let people write once, run everywhere, meaning that compiled java code can run on all platforms that support java without the need for recompilation.
What is a run-time error?
When a program complies and runs but produces the wrong output.
How must dates be written in java?
Year, month, day
What is the variable type double?
a number that has a decimal point
What is object oriented programming?
it is a way to program in a programming language using objects.
What is a variable?
it is used to store a value you will use later.
What is a method?
the actions you can apply to an object, they are the instructions the program executes. It is located after the variable and before the parenthesis.