Scjp
edit
Summary
Questions for the Java Programmer Cert, Section 1 (Declarations, Initialization and Scoping).Exam Objectives - Section 1
Listed at the #objectives
On Sun's site
http://www.sun.com/training/catalog/courses/CX-310-055.xml"
Basics
| Term (memorize) | Description (memorize) |
|---|---|
| Class | Blueprint used to make an object |
| Object | main building-block of java applications |
| Method | Java word for function |
| Member variables | variables defined in a class |
| 2 main things in a class | methods and member variables |
| Usually required to call a method? | an object |
Basic Code
| Question (memorize) | Answer (memorize) |
|---|---|
| Define a class | class MyClass { |
| Define a method | void myMethod() { |
| Define a member | int i; |
| Define a main() method | public static void main( String[] args ) { |
| Create an object | MyClass myObject = new MyClass(); |
| Call a method | myObject.myMethod(); |
Object-Oriented concepts
Java is a thoroughly object-oriented language. Objects are the primary building blocks of Java applications. You can think of objects as containers for variables and methods (functions). When speaking at a high level, "object" and "class" are sometimes used interchangably, even though a class is a definition used to create an object.
| Question (memorize) | Answer (memorize) |
|---|---|
| OO | Object-Oriented |
| Subclass | A child class of another class |
| Example of superclass and subclass | Employee, Engineer |
| Method overriding | Method in a subclass with same signature as superclass |
| Method overloading | Method in a class with same name as another method |
| Keyword for subclassing | MySuperclass extends MySubclass |
| What does a subclass inherit from superclass? | methods (non-private) and member variables |
Synonyms
Synonyms are rampant in the Java world. For example, it isn't uncommon for someone to use "object" and "instance" in the same sentence to refer to the same thing. This can be confusing to newbies.
| Term (memorize) | Synonym (memorize) |
|---|---|
| Superclass | Parent class, Base class |
| Subclass | Child class, Derived class |
| Function | Method |
| Instance | Object |
| Type | Class |
| Member | Member Variable |
Classes
| Question (memorize) | Answer (memorize) |
|---|---|
| Abstract class | Class that can't be instantiated |
| What is a top-level class? | A class not defined within another class |
| Modifiers allowed for a top-level class? | public, abstract, final |
| Final class | A class that can't be subclassed |
Methods
| Question (memorize) | Answer (memorize) |
|---|---|
| Static method | Can be called without an object |
| Abstract method | Method with no body |
| Name all access modifiers | public private default (package) protected |
| Final method | A method that can't be overridden |
Types
| Question (memorize) | Answer (memorize) |
|---|---|
| All integer types are... | signed |
| In Java, variables are either... | - references to objects - or, primitive types |
| Name all primitive types | - boolean, char - byte, short, int, long - float double |
| Primitive (memorize) | Description (memorize) |
|---|---|
| boolean | 1 bit (true or false) |
| char | 2 byte unicode character (0 to 216-1) |
| byte | 1 byte integer (-27 to 27-1) |
| short | 2 byte integer (-215 to 215-1) |
| int | 4 byte integer (-231 to 231-1) |
| long | 8 byte integer (-263 to 263-1) |
| float | 4 byte floating point |
| double | 8 byte floating point |
Character Escape Codes
| Escape Code (memorize) | Description (memorize) |
|---|---|
| \n | New line |
| \t | Tab |
| \b | Backspace |
| \r | Carriage return |
| \f | Formfeed |
| \\ | Backslash |
| \' | Single quotation mark |
| \" | Double quotation mark |
| \d | Octal |
| \xd | Hexadecimal |
| \ud | Unicode character |
Gotcha's
| Question (memorize) | Answer (memorize) |
|---|---|
| Can a class be static? | Yes, but only an inner class |
| Can a non-abstract class have an abstract method? | no |
| Can an abstract class have a non-abstract method? | yes |
Advanced
| Question (memorize) | Answer (memorize) |
|---|---|
| Name all modifiers | access: private, default (package), protected, public non-access: static abstract final synchronized native strictfp transient volatile |





