Just Java(TM) 2 (6th Edition) by Peter van der Linden

By Peter van der Linden

E-book do disguise the entire themes yet probably not intimately. It was once my path requirement.

Show description

Read Online or Download Just Java(TM) 2 (6th Edition) PDF

Similar programming: programming languages books

Objektorientierte Programmiersprache C++: Vollständige Einführung anhand von Beispielen (VDI-Buch) (German Edition)

In diesem Werk werden alle Aspekte der Sprache C++ behandelt, deshalb ist das Buch ebenso für Einsteiger, mit oder ohne Vorkenntnisse über eine andere Programmiersprache, als auch für Umsteiger von anderen Programmiersprachen bzw. C-Programmierer geeignet. Die Darstellung der Sachverhalte erfolgt knapp und systematisch, die Beispiele sind kurz, prägnant und compiler- unabhängig und auf allen Rechnern mit C++ 2.

Extra resources for Just Java(TM) 2 (6th Edition)

Example text

The initialization done in the constructor is a one-timeGUI set-up: the label is added to the frame, the frame is told that the program should exit if someone closes it, and the frame is given a size of 95 pixels wide by 45 pixels high. The second method getDigitsAsString() takes the integer argument, and returns the equivalent string, zero-padded to be exactly two digits long. The plus sign in this method and the next one is not arithmetic addition. It is a special operator that is defined to take a string as the first operand and anything else as the second operand.

This is an OOP concept called inheritance and it is important enough to have Chapter 8 devoted to it. Inheritance is what you get from your parents, and it means that ClockView has all the fields and methods of its parent, the JFrame class. main() routine can call a ClockView method called setVisible, even though we don't see setVisible() defined previously. It comes from the parent JFrame. ClockView has one field, tLabel, and three methods. The first "method" is actually a constructor. When this is invoked, the run-time system allocates the storage for a ClockView object, then executes the statements in the body to initialize the new object.

If you didn't explicitly provide any constructors, a simple implicit one is provided on your behalf. Our Timestamp class does not have any explicit constructors, so it gets the implicit one. The next two lines show an object declaration, then a constructor call. The return value from the constructor is a pointer to the freshly created object. Variable cv is assigned that pointer. ClockView cv; cv = new ClockView(); The keyword new is a tipoff that the programmer intends a constructor call, not a regular method.

Download PDF sample

Rated 4.31 of 5 – based on 9 votes