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 Murach's Java Servlets and JSP this week in the Servlets 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: 14074
    
  16

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 7 API documentation
Scala Notes - My blog about Scala
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: using final while creating object
 
Similar Threads
first whack at JSP not working
* Welcome Jevgeni Kabanov and Toomas R�mer
Running JAR from Ccmmand Line
JAAS programatically
Problem with JERSEY and JAX-RS