this is the difference between static and non-static

Thursday, June 30, 2011

Corrections in 'The class of JAVA' book

The following are corrections in 'The class of JAVA' book.


Page 11, exercise 2
    (e) Java output generated by Java compiler is
should be replaced with
    (e) The output generated by Java compiler is

Page 17, first line below the figure 2.1
    codejavadoc -d ../docs Hello.java
should be replaced with
    javadoc -d ../docs Hello.java

Page 17, first line after the first paragraph.
    codejavadoc -d ../docs -package Hello.java
should be replaced with
    javadoc -d ../docs -package Hello.java

Page 34, lessons learned last bullet point, last line
    by using \following
should be replaced with
    by using following

Page 34, exercise 1
    (m) \0905 is a valid identifier in Java (\0905 is a letter in the ...
should be replaced with
    (m) \u0905 is a valid identifier in Java (\u0905 is a letter in the ...

Page 37, Listing  4.1, line 6
    System.out.println("i = "+i+", j = "_j);
should be replaced with
    System.out.println("i = "+i+", j = "+j);

Page 87, lessons learned
    An interface can have any non-abstract methods,...
should be replaced with
    An interface cannot have any non-abstract methods,...

Page 120, third last line
    If the returned value is positive then x is considered to precede y.
should be replaced with
    If the returned value is negative then x is considered to precede y.

Page 121, Listing 10.3 line 5
    public class NameComparator<Account> implements Comparator<Account>
should be replaced with
    public class NameComparator implements Comparator<Account>

Page 123, line 3
    The String class implements Comparabe interface
should be replaced with
    The String class implements Comparable interface

Page 130, in last three lines
    In Line 7, the balance would be 15000, now Line 9 makes ac in the method refer to
    a new Object, so the Object refered by ac in Line 1 is unaffected. Line 9 would make the
    method loose the reference to the object which was passed as a parameter in Line 4.
should be replaced with
    In Line 3 of the method, the balance would be 15000, now Line 5 in method makes ac refer to
    a new Object, so the Object refered by ac in Line 1 is unaffected. Line 5 in method would make the
    method loose the reference to the object which was passed as a parameter in Line 4.

 Page 143, in listing before Section 11.4, line 1
    public class Car extednds Vehicls {
should be replaced with
    public class Car extends Vehicle {

Page 163, Listing 12.7 line 61
    for (transactionIndex = 0; transactionIndex < nextTransactionIndexInPassbook; transactionIndex++)
should be replaced with
    for (transactionIndex = 0; transactionIndex < nextIndexInPassbook; transactionIndex++)

Page 168, Listing 12.10 line 16
    private (int maxDays)
should be replaced with
    private Month(int maxDays)

Page 168, Listing 12.10 line 27
    (this.ordinal() >= to.ordinal()));
should be replaced with
    (this.ordinal() >= from.ordinal()));

Page 186, Listing 13.14 line 3
    public Object setValue()
should be replaced with
    public Object setValue(Object o)

Page 187, in code snipped listing line 1.
    DateFormat dateFormat = new DateFormat("dd-MMM-yyyy");
should be replaced with
    DateFormat dateFormat = new SimpleDateFormat("dd-MMM-yyyy");

Page 193, Listing 13.20 line 3
    public boolena hasNext();
should be replaced with
    public boolean hasNext();

Page 220, Listing 14.4 Line 6 and 7
    long m1 = d1.lastModified();
    long m2 = d2.lastModified();
should be replaced with
    long m1 = d1.getTime();
    long m2 = d2.getTime();

Page 227, Listing 14.4, line 6
    public void mark(itn readlimit)
should be replaced with
    public void mark(int readlimit)

Page 241, BufferedOutputStream paragraph, 2nd line
    Filter- OutputStream
should be replaced with
    FilterOutputStream

Page 267, Section 15.1.1.3, 2nd paragraph, line 7,
    10101000 0101000 00000001 ...
should be replaced with
    10101000 0101100 00000001 ...

Page 270, 7th line after listing 15.1
    byte[] ipaddress = byte[]202,153,27,54;
should be replaced with
    byte[] ipaddress = new byte[]{202,153,27,54};

Page 318, Listing 17.7 title
    Listing 17.7.Hello world using getGraphcis()
should be replaced with
    Listing 17.7.Hello world using getGraphics()

Page 336, Listing 18.14, line 1
    public MenuBAr()
should be replaced with
    public MenuBar()


Readers can send comments and corrections to pravin@classofjava.com
Thanks
Pravin

18 comments:

Anonymous said...

sir,
you have wrote the correction on page no.163 something like this...

transactionIndex = nextIndexInPassbook

where in book is

transactionIndex < nextIndexInPassbook

please tell me which 1 is the right???

The class of JAVA said...

Thanks for pointign the mistake in the correction. I have updated the post accordingly.
Thanks
Pravin

Anonymous said...

sir,
i m trying to use javac -d ../bin command in windows but it is not working

and i tried with direct javac filename.java command then i cannot manage the packages and it gives the package errors..

The class of JAVA said...

on windows platform try using javac -d ..\bin
and also use the command from the src folder, you should also have created teh bin folder at the same level as src.

Anonymous said...

Hello Sir,

I want the solution of exercises ...

ravi said...

page no:87
in lessons learned
An interface can have any non-abstract methods,
should be replaced with
An abstract class can have any non-abstract methods,
or
An interface can not have any non-abstract methods,

ravi said...

page no:318
Listing 17.7. Hello world using getGraphcis()
should be replaced with
Listing 17.7. Hello world using getGraphics()

ravi said...

page no:174
DateFormat dateFormat=new DateFormat("dd-MMM-yyyy");
in java.util
DateFormat class is an abstract class and has only one protected constuctor with no parameter,
a method required to create instace of DateFormat.

The class of JAVA said...

Thanks ravi for the corrections.
I have updated the post accordingly.

ravi said...

page 220, Listing 14.4, line 6,7
long m1=d1.lastModified();
long m2=d2.lastModified();
lastModified() method is not
availble for Date class,
there is a getTime() method &
this Date constuctor is a
Deprecated Constructor.

ravi said...

page 227, Listing 14.9,line 6
public void mark(itn readlimit)

ravi said...

page 270,
byte[ ] ipaddress=byte[ ]202,164,27,54;
byte can only represent number between -128 to +127.there is posibility of loss of precision.
this array can be represented as:
byte[ ] ipaddress =new byte[ ]{202,164,27,54};
or byte[ ] ipaddress={202,164,27,54};

ravi said...

page 241,
in BufferdOutputStream paragraph
a big white space between Filter and OutputStream

ravi said...

page 267
192.168.88.1 : 11000000 10101000 01010000 00000001
should be replaced with
192.168.88.1 : 11000000 10101000 01011000 00000001

The class of JAVA said...

Thanks Ravi once again for the corrections.
I have updated the post accordingly.

ravi said...

page 34
lesson learned (last point)
\followed

page 37
Listing 4.1
System.out.println("i = "+i+", j="_j);

page 123
paragraph - The String class ...
Comparabe interface...

page 336
Listing 18.14
public MenuBAr()

ravi said...
This comment has been removed by the author.
The class of JAVA said...

Thanks Ravi once again for the corrections.
I have updated the post accordingly