0% found this document useful (0 votes)
3 views

Java Chapter 3 Notes

The document provides an overview of Java programming concepts, including definitions of classes, objects, methods, and applications. It also covers syntax rules, code conventions, and the importance of algorithms and pseudocode. Key elements such as output streams, arguments, and escape sequences are explained with examples.

Uploaded by

blount.whatever
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
3 views

Java Chapter 3 Notes

The document provides an overview of Java programming concepts, including definitions of classes, objects, methods, and applications. It also covers syntax rules, code conventions, and the importance of algorithms and pseudocode. Key elements such as output streams, arguments, and escape sequences are explained with examples.

Uploaded by

blount.whatever
Copyright
© © All Rights Reserved
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 3

Jamel Blount

Java Chapter 3 Notes: Introducing Java (pages 59-70)

1. What is Java?
A programming language.

2. What is a Class?
Defines the type of data and actions associated with an object of that class, but not the
actual data for an individual object.

3. What is an Object? How does it differ from a class?


Consisted of related data and the instructions for performing actions on that data. It differs from a
class because a class defines the type of data.

TIP: Why is code reusability useful?

4. What is a Java application?


A package with at least one class that contains a main() method.

5. What is required to indicate the end of a statement?


A semi colon

6. What are curly braces ({ }) used for?


To begin and end instructions

7. public static void main(String[] args) defines the main() method.


(^ ^ ^ ^ ^ ^ ^ ^ ^ MEMORIZE THIS LINE ^ ^ ^ ^ ^ ^ ^ ^ ^)
What is a method?
A method is a named set of statements that perform a single, well-
defined task.

Where is the main() method placed?


In the controlling class
What happens to the statements in this method when the program is executed?
They are automatically run.
8. Comments:

/* */ are used for…


closing comments.

// are used for…


adding a comment to the end of a statement

9. Define:
source code- java code typed by a programmer
Jamel Blount
What extension do source code files have? .
.java

compiling-
What extension do compiled files have?
.class

bytecode- compiled java source code

syntax error-
What is an example of a syntax error?
error in a statement that violates the rules of java

10. What are code conventions?


Guidelines for writing an application
Why is following code conventions useful?
Easier to read and understand
What are the code conventions? (Ignore package)
Introduction comment to begin a program
Class names should be nouns, every word should begin with a capital letter
Comment block before before each class or code(not before the main()method)
Comments shouldnt state the code again
Statements in methods should be indented
Open curly brace should be on the same line as the class or method,closing curly brace should be on a
separate line aligned with the class or method

11. What is an algorithm?


Set of steps that show how to solve a problem
What is pseudocode?
Mix of programming code and english
12. What is an output stream?
Sends data to on output device
What are the two methods to send data to the output stream? Explain the difference.
print() and printIn() methods, the difference is how they control the output. print() displays data and
leaves the insertion point at the end of output.printIn() moves the insertion point to the next line after
displaying the data.
13. What is an argument? What have we called this before?
A data passed to a method
What is a String?
a set of characters that are enclosed by quotation marks.

14. What is an escape sequence? What are the 4 common escape sequences?
backslash followed by a symbol that represents a character.
\n newline
\t= tab(8 spaces)
Jamel Blount
\\ backslash
\” double quotation mark

You might also like