Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

Q: const?

Thread view: 
Jakob Bieling - 27 Jun 2005 17:49 GMT
Hi,

   now this may seem like a very very basic question .. how do I define
constant in Java? In C++ you do 'static int const max_chars = 255;' ..
just in case I was not using the correct terminology to describe what I
am looking for.

Thanks!
Signature

jb

(reply address in rot13, unscramble first)

Joan - 27 Jun 2005 18:10 GMT
> Hi,
>
[quoted text clipped - 4 lines]
>
> Thanks

static final int STOP    = 0;
Eric Sosman - 27 Jun 2005 18:11 GMT
> Hi,
>
>     now this may seem like a very very basic question .. how do I define
> constant in Java? In C++ you do 'static int const max_chars = 255;' ..
> just in case I was not using the correct terminology to describe what I
> am looking for.

   static final int max_chars = 255;

   There are semantic differences between `final' and
`const'.  Don't just make textual substitutions and
assume you understand what they mean; read your Java
textbook.

Signature

Eric.Sosman@sun.com

Joan - 27 Jun 2005 18:40 GMT
> > Hi,
> >
[quoted text clipped - 9 lines]
> assume you understand what they mean; read your Java
> textbook.

Good point, but for me it is either provide no help by just saying "it is
not supported so
take your little problem and go home" or
to provide some guidance as to what might be done instead should they
wish to investigate further.

> --
> Eric.Sosman@sun.com
Eric Sosman - 27 Jun 2005 19:22 GMT
>>>Hi,
>>>
[quoted text clipped - 15 lines]
> to provide some guidance as to what might be done instead should they
> wish to investigate further.

   Joan, I don't understand your response.  I pointed
the original questioner to `final' as a substitute for
some uses of `const', and warned him that the two were
not exactly the same.  Do you think I told him too much?
Too little?  Or what?

Signature

Eric.Sosman@sun.com

Andrew Thompson - 27 Jun 2005 19:45 GMT
>>>    There are semantic differences between `final' and
>>>`const'.  
..
>> Good point, but for me it is either provide no help by just saying "it is
>> not supported so
[quoted text clipped - 3 lines]
>
>     Joan, I don't understand your response.  ..

Perhaps some context..
<http://groups.google.com.au/group/comp.lang.java.programmer/msg/fc11ddb75f6e78be>

Signature

Andrew Thompson
http://www.PhySci.org/codes/  Web & IT Help
http://www.PhySci.org/  Open-source software suite
http://www.1point1C.org/  Science & Technology
http://www.LensEscapes.com/  Images that escape the mundane

Joan - 28 Jun 2005 02:42 GMT
> >>>    now this may seem like a very very basic question .. how do I define
> >>>constant in Java? In C++ you do 'static int const max_chars = 255;' ..
[quoted text clipped - 19 lines]
> not exactly the same.  Do you think I told him too much?
> Too little?  Or what?

Oh, Sorry Eric, I wasn't thinking too much.
I have been a little paranoid lately and thought you
were criticizing me rather than giving advice to the OP
Jakob Bieling - 28 Jun 2005 06:09 GMT
>> Hi,
>>
[quoted text clipped - 12 lines]
> assume you understand what they mean; read your Java
> textbook.

   Thank you! I will :)
Signature

jb

(reply address in rot13, unscramble first)



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.