File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Beginning Java and the fly likes using final while creating object Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of Soft Skills this week in the Jobs Discussion forum!
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "using final while creating object" Watch "using final while creating object" New topic
Author

using final while creating object

shruti patel
Ranch Hand

Joined: Mar 10, 2008
Posts: 52
Hi,
Is it a legal statement.

Final Demo d=new Demo();

Explain
sharad sinha
Greenhorn

Joined: Jul 13, 2008
Posts: 26
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 ]

Thanks, Sharad<br />SCJP 5 (July, 2008)
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14428
    
  23

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.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using final while creating object