1 Basics of Java Programming


1.1

(d)

A method is an operation defining the behavior for a particular abstraction. Java implements abstractions, using classes that have properties and behavior. Behavior is dictated by the operations of the abstraction.

1.2

(b)

An object is an instance of a class. Objects are created from class definitions that implement abstractions. The objects that are created are concrete realizations of those abstractions.

1.3

(b)

The code marked with (2) is a constructor. A constructor in Java is declared like a method, except that the name is identical to the class name and it does not specify a return value.

1.4

(b) and (f)

Two objects and three reference variables are created by the code. Objects are typically created by using the new operator. Declaration of a reference variable creates a variable regardless of whether a reference value is assigned to it or not.

1.5

(d)

An instance member is a field or an instance method. These members belong to an instance of the class rather than the class as a whole. Members which are not explicitly declared static in a class definition are instance members.

1.6

(c)

An object can pass a message to another object by calling an instance method of the other object.

1.7

(d) and (f)

Given the declaration class B extends A {...} we can conclude that class B extends class A , class A is the superclass of class B , class B is a subclass of class A , and class B inherits from class A , which means that objects of class B will inherit the field value1 from class A .

1.8

(d)

The compiler supplied with the Java 2 SDK is named javac . It requires the names of the source files that should be compiled.

1.9

(a)

Java programs are executed by the Java Virtual Machine (JVM). In the Java 2 SDK, the command java is used to start the execution by the JVM. The java command requires the name of a class that has a valid main() method. The JVM starts the program execution by calling the main() method of the given class. The exact name of the class should be specified, and not the name of the class file, that is, the " .class " extension in the class file name should not be specified.



A Programmer[ap]s Guide to Java Certification
A Programmer[ap]s Guide to Java Certification
ISBN: 201596148
EAN: N/A
Year: 2003
Pages: 284

flylib.com © 2008-2017.
If you may any questions please contact us: flylib@qtcs.net