• Post Reply Bookmark Topic Watch Topic
  • New Topic

I/O Stream

 
Rahul200676
Greenhorn
Posts: 3
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
How can I use the const keywork in java
 
Carl Trusiak
Sheriff
Posts: 3341
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
const is a reservered word in Java so therefore can not be used a a name for a variable, class etc. Java doen't implement the const reserved word in any way so, it can not be used.
const in c and c++ is used to indicate that the value of a varible will not and can not be changed. Java uses the keywork final for this.
Please read and follow the JavaRanch Naming Policy. Pay attention to possible actions for failing to follow the policy. It also can benfit you read Book Promotions
This topic is actually better suited for the beginners foum, I'm going to move it there.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!