• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

using final while creating object

 
shruti patel
Ranch Hand
Posts: 52
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi,
Is it a legal statement.

Final Demo d=new Demo();

Explain
 
sharad sinha
Greenhorn
Posts: 26
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Yes it is correct. References can be final. Final references can not be reassigned to anything else once an object is assigned. The state of the object however can change. There is nothing called final object in Java. Also it should be final not Final.
[ August 23, 2008: Message edited by: sharad sinha ]
 
Jesper de Jong
Java Cowboy
Saloon Keeper
Posts: 15480
43
Android IntelliJ IDE Java Scala Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Originally posted by shruti patel:
Is it a legal statement.

Final Demo d=new Demo();

No, because Java is case-sensitive and "Final" is not a Java keyword.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic