chapter 1 Flashcards
What are 8 benefits of Java?
- Object Oriented
- Encapsulation
- Platform Independent
- Robust
- Simple
- Secure
- Multithreaded
- Backward Compatibility
What are the the basic building blocks in java programs?
classes
What is an oject?
A runtime instance of a class in memory.
What is a reference?
A variable that points to an object.
What are the two primary elements of a class in Java?
methods and fields (variables).
What makes up a method signature?
method name and parameter types.
What makes up a method declaration?
method name, parameter types, and return type.
Describe three different types of comments in java.
single line comment // comment multi line comments /**/ or /** * Java Doc comment */
Where does a Java program begin execution?
the main()
What must a file have to compile Java code?
A .java file extension and a filename that matches the class name.
What is the result of compiling a .java file?
A file of bytecode by the same name but with a .class extension.
How many public classes are allowed in a file?
one.
What is the syntax for the single-file source-code-command?
java HelloWorld.java
What is the single-file source-code-command
Command to run java programs that exist in a single file.
Does the single-file source-code-command produce a .class file?
No, the program is contained in memory.
What are the constraints placed on programs run with the single-file source-code-command?
They are for programs with only one class.
Can only import code that came with the JDK.
What are packages?
Logical groupings of classes.
What do import statements do?
Tell java which package to look in for a class.
How do you know a package comes from the JDK?
The package name starts with java or javax.