Win a copy of Programmer's Guide to Java SE 8 Oracle Certified Associate (OCA) this week in the OCAJP forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Other Modifiers for Members

 
Abhijit Natu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi here's a question from Khalid-Mughal's book
page 130 Q4.26
Which of these are not Legal Declarations within a class
select all valid answers.
a) static int a;
b) final Object[] fudge ={null};
c) abstract int t;
d) native void sneeze();
e) final transient static private double PI = 3.14159265358979
I thought the answers were (c) & (e)
as
c) a variable can not be declared abstract
e) a varibale can not be both transient and static
but the book says the answer is (c) only
On page 126 there's note under the Transient Variables which also says that a varibale can not be both transient and static as static vars do not belong to the objects .
I am wondering if there is some mistake in the book or am I overlooking something !!!Please help ,
Abhijit.
 
Oliver Grass
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by Abhijit Natu:
I am wondering if there is some mistake in the book or am I overlooking something !!!Please help ,
Abhijit.

Hi,
you're right, the book is wrong. Look at the errata for the RHE, they are writing, that the Note should be deleted....
hope that helps
Oliver
 
Harpal Singh
Ranch Hand
Posts: 229
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oliver............
the error is in Khalid's book ........why should he look in to errata written on RHE???
Harpal
 
Abhijit Natu
Greenhorn
Posts: 4
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
I tried the plugging the line
" final static trnasient float PI = 3.1415F;"
in a program and it works
without giving any compilation errors !!!
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic