Documente Academic
Documente Profesional
Documente Cultură
• interpreter
- is a program that read and executes instructions written in the from of a
program
- the trick of an interpreter is that is loads the source code and translates the
instruction into executable machine language line by line
- in order run a program you have to load the interpreter first then laod the
source code into the computer and then type”run ” to execute the program.
• Comment
Comment is a program are entirely ignored by the computer; they are there
for human readers only. This doesn’t mean that they are unimportant.
Program are meant to be read by people as well as by computer, and
without comments , a program can be very difficult to understand.
• Command line arguments
Our Hello World program still isn’t very general. We can be change the
name we say hello to without editing and recompiling the source code.what
we need is a way to change the name at runtime rather than at compile time.
For example: public class helloworld {
// a program to diplay the message
// “hello world” on standard output
Public static void main(string[]args) {
System.out.println(“Hello);
System.out.println(args[0]);
}
}
3. what the use of “loop” provider some examples using different types of loops.
4. defin “constructor”
contructor: is call to a special type of subroutne called a construcor. Every
class a contructor. If the programmer doesn’t define one, the program will
provider a default constructor the only allocate memory and initialize instance
variable. A constructor does not hava return type the name of constructor must
be the same as the mane of class in which its defined .in particular,constructor
cant be declared static. It must be public ,private and protected
4. explain “garbage collection”
Garbage collection in the responsibility of the system,not the programmer to keep
track of which object are “gardege”.if an object stored in several varialbes.the object
doesn’t become garbage until all those references have been dropped.
5.define inhertance,polymorphism and abstract classes
• Inhertance:
- it refer to the fact that one class can inherit part or all of its structure and
bbhavior from another class.
- The class that does the inherting is said to be a subclass of the class from
which it inherits.
• Polymorphism
- three classes,rectange,oval, and RoundRect,could be used to represent the
three types of shaped.
- These three classes would hava a common super class,shape, to represenet
features that all three shapes have in common.
- The shape class could include instance variables to represent the color,
position, and size of a shape.it could include instance methods for changing
the color, position, and size of a shape.
• Astracture class:
An abstract class is one that is not used to construct object, but only as a
basic for making subclasses. An abstract class exit only to express the
common properties of all its subclasses.
It exists merely specify the common interface of all the actual, concrete
version of redraw () in the subclasses of shape. There is no reason for the
abstract redraw() in class shape to contain nay code at all.
For example:
Class employee {
//an object of type employee hold data about one employee
String name; // name of the employee
Employee supervisor; //the employees supervisor.
}
• Queue
- a queue has two ends called the front and the back of a queue.
- Items are always added to the
- Queues at the back and removed from the queue at the end
Chepter 10 debugging