How to javadoc "public final static int"?

How can we create "Field Summary" HTML document for "public final static int" variables?
This question is probably same as the below question.
http://forums.java.sun.com/thread.jsp?forum=41&thread=72832
p.s.
The below document indicates CENTER, NORTH, ...
How an we achieve it to document "public final static" variables?
http://java.sun.com/products/jdk/1.2/docs/api/index.html

No, 1.3 does not have the static constant values exposed to the Doclet API,
and so that information is not available to any doclets to place in the
generated documentation.
BTW, based on feedback from a developer, we changed the format from:
public static final int NORTH = 0
to
public static final int NORTH
See: Constant values
where the "Constant values" link takes them to a summary page that
lists all of the values. This helps discourage users from mistakenly
seeing and using the value instead of the constant.
-Doug Kramer
Javadoc team

Similar Messages

  • Discussion: private final static vs public final static

    take following class variable:public final static int constant = 1;Is there any harm in making this variable public if it's not used (and never will be) in any other class?
    Under the same assumption Is there any point in making this variable static?
    tx for your input

    Is there any harm in making this variablepublic
    if it's not used (and never will
    be) in any other class?Harm? No. Use? Neither.I suppose it makes no difference at all concerning
    runtime performance?
    Under the same assumption Is there any point inmaking this variable
    static?If the creation of the constant is costly, for
    instance. A logger is private final static most of
    the time.Same here, does making a variable final or static
    have any influence on runtime performance?No. And for 'expensive' operations (say, parsing a XML configuration file, which only needs to occur once), making a variable static will improve performance.
    - Saish

  • What is public static int??

    hi everybody,
    I am attending data structure and alogrithms class ...i wanna know about all, so which book can I read to understand.
    Also in java what is the meaning of
    "public static int"....
    it have got "return" what is the meaning it ??
    best regards
    blazer

    Perhaps you should try the Java forums and not the Sun Ray forum :)

  • Loading the final static variables at run time.. Please help

    Hello, fellow developers & Gurus,
    Please help me figure out the best way to do this:
    I need to load all my constants at run time. These are the public static final instance variables. The variables values are in the DataBase. How do I go about loading them.

    Your original question was diffeent, but your further posts show what you really want to do:
    1) all constants in 1 class
    2) available readonly for other classes
    3) updatable during runtime by changing in the database
    Did I understand you right?
    Then smiths' approach solves point 2):
    Instead, make the variables available through a method
    call - that way you avoid the whole final variable
    versus read-only attributes problem.
    //GLOBAL VARIABLES EXPOSED AS PUBLIC PROPERTIES
    public final class GlobalProperties
    public static int getTableSize();
    public static int getRowSize();
    Each "constant" should be a private static variable, and these methods simply return their values.
    The variables are initialized in a static initializer by accessing the db. Ok.
    You habe a table with one row containing as columns all the constants.
    A method readConstants() does a "select constant1, constant2, ... from const_table" and sets all the variables.
    The static initializer calls this method.
    Right?
    Ok, then you simply call readConstants() everytime you want to synchronize with the actual content of const_table.
    Was it this?

  • How do use the method record(int score) in this code?

    how do i use record(int score) from the class Stats to record a new score?
    public class ScoreInfo {
    private int score;
    private int numStudents;
    public ScoreInfo(int aScore){
          score = aScore;
          numStudents=1;
    public void increment(){numStudents++;}
    public int getScore(){return score;}
    public int getFrequency(){return numStudents;}
    import java.util.ArrayList;
    import java.*;
    public class Stats
    private ArrayList<ScoreInfo> scoreList;
    public boolean record(int score)
         int k=0;
         while(k<scoreList.size() && score > scoreList.get(k).getScore()){
              k++;
         boolean found = k<scoreList.size() && score == scoreList.get(k).getScore();
          if(found){scoreList.get(k).increment();}
          else{scoreList.add(k,new ScoreInfo(score));}
          return found;
    public void recordScores(int[] stuScores)
    static int score = 50;
    public static void main(String[] args) throws Exception
    Stats stats = new Stats();
    ScoreInfo thestat = new ScoreInfo(score);
    stats.scoreList.add(thestat);
    }

    hiwa wrote:
    In your main() method, or in any code which tries to create a new score, below is wrong:
    ScoreInfo thestat = new ScoreInfo(score);
    stats.scoreList.add(thestat);They should be:
    stats.record(thestat); // record() method creates a new ScoreInfo
    // and add it to the scoreList, see your own posted code
    stats.record(thestat); will not work because record has a parameter that needs an integer not an object
    i tried public static void main(String[] args) throws Exception
    Stats stats = new Stats();
    ScoreInfo thestat = new ScoreInfo(7);
    stats.record(7);
    but i get this error Exception in thread "main" java.lang.NullPointerException
    at Stats.record(Stats.java:13)
    at Stats.main(Stats.java:39)

  • Static int

    Hello guys, I have this public static int ID = 1; in my main class. However, i wanted to increment it at a different class. That was why i declared it to public. And i really need it to be static.
    Here is the incrementation in a different class int x = Driver.ID;
    Driver.ID = x++;The problem now is the ID in the Driver class does not increase. Please explain and tell me a solution. Thank you.

    Just as a somewhat unrelated suggestion.
    It would be better if you made a public method in your driver class to increment your ID variable(which by the way is named wrong, as its name suggests it is final).
    This way you don't even have to declare it to public, you can leave it private or protected. It also makes your code overall much more easier to read and maintain. And last but certainly not least it makes your driver class more reuse friendly for any other classes that want to use it or increment ID in it, even in the future, without the necessity of removing any control you have over it.
    Anytime you want to change data in another class your thoughts should be "what does that class have to let me do that?" If the answer is nothing but you authored both classes, then before doing it the way you did, you should consider adding a method to the class with the data to allow the answer to be present the next time you ask it.
    Forcing data changes the way you did will eventually cause you headaches. So it is best to get into the right habbits now, rather than having to learn the hard way.
    JSG

  • How do I make a static reference to a method?  Sample Code Included

    Why doesn't this work? How do I use the method add(int a, int b)?
    ERROR - "Can't make static reference to method int add(int, int) in testClass"
    interface testInterface{
        static String sString = "TESTING";
        int add(int a, int b);
    class testClass implements testInterface{
        public int add(int a, int b){
            return a+b;  
        public static void main(String argv[]){
            int sum = add(3,4);    // here's the error
            System.out.println("test");
            System.out.println( sum );
    }

    Why doesn't this work?Because you can't call a non-static method like add (which operates on the object called this) from a static method like main (for which there is no this).
    There are two ways to fix this:
    (1) In main, create a TestClass object, and call add() for that object:
    class TestClass implements TestInterface {
       public int add(int a, int b) {
          return a+b;
       public static void main(String[] args) {
          TestClass testObject = new TestClass();
          int sum = testObject.add(3, 4);
          System.out.println("test");
          System.out.println(sum);
    }(2) Make add() static. This is the preferred approach, because add() doesn't really need a TestClass object.
    class TestClass implements TestInterface {
       public static int add(int a, int b) {
          return a+b;
       // main is same as the original
    }

  • Private,public and static variable

    I am just not able to understand the use of declaring the variable as private.Because even if i declare the variable as public ,other user of the same application anyway will never be acess that variable !! Can someone clear my doubt.
    Also can some one tell me when can I declare a variable as static...that is ideallly when should i declare a variable as static (and for that matter private and public )
    Thanks.
    Tha

    Hi,
    There are some rules for variable declarations:
    Only the containing class and its inner classes can access private variables.
    Every class can access public variables.
    All classes in the same package can access protected variables.
    Imagine you're writing a program for archiving all your CD's.
    If you want to know how many cd's you have got you simply read the static variable.
    public class CD {
    private String name, author;
    public static int cdCount = 0;
    public CD(String name, String author){
    //do something to initialize
    cdCount++; //Increase the value, because a new CD has been created.
    public static int getCDCount(){      //static methods can be accessed without creating instances of classes
    return cdCount;
    public static void main(String[] args){
    CD kravitz = new CD("Lenny Kravitz", "A Song");
    CD britney = new CD("Britney Spears", "Another Song");
    System.out.println("You have " CD.getCDCount() " CDs"); //You call static methods on the class (you can also call them on instances, but it is important that you do not need to create a object of that class)
    }

  • Final static method

    I have a class as follows that I instantiate in another program by:
    CalcsLin calcsLin=new CalcsLin();
    and use like:
    r=calcsLin.tunits(r,2,4);
    We obviously need "final static" on conv[ ], but I have not used it on tunits().
    My questions are: What does "final static" do on tunits()?
    Is it good to use it?
    And does each usage still get its own separate copy of "f" and "i"?
    public class CalcsLin {
      final static double conv[] = {  12.0,  30.0, 24.0, 60.0, 60.0, 100.0 };  //example numbers only
      final static double tunits(double r, int levfr, int levto) {
        double f=1.0;
        if(levfr<=levto) {
          for(int i=levfr;i<=levto-1;i++)f=f*conv; r=r*f;
    } else {
    for(int i=levto;i<=levfr-1;i++)f=f*conv[i]; r=r/f;
    } return(r);

    Have you read the links I posted?
    Static means that that method is part of the class, and not part of an object of that class.
    Both will work, but first is preferred:
    CalcsLin.tunits(1,2,3);
    c = new CalcsLin();
    c.tunits(1,2,3);And yes, it will work if you left static out, but I think it's in the right place there.
    Besides that I realized too late that I only answered the first question, here are the other answers.
    2nd: It is good to use it if (and only if) it makes sense. For example the [Math-class|http://java.sun.com/javase/6/docs/api/java/lang/Math.html]: the value of log(42) does not rely on any instance of the Math-class (if it was possible to instantiate this class) but is always the same equation, in those cases static functions are usefull. To make a static-method final isn't very usefull because the best way to call a static method is with it's class-name (thus CalcsLin.tunits(1,2,3); and not c = new CalcsLin(); c.log(1,2,3)).
    3rd: Yes, every call of the method will have it's own 'instance' of f and i.

  • How can I share a static field between 2 class loaders?

    Hi,
    I've been googling for 2 days and it now seems I'm not understanding something because nobody seems to have my problem. Please, somebody tell me if I'm crazy.
    The system's architecture:
    I've got a web application running in a SunOne server. The app uses Struts for the MVC part and Spring to deal with business services and DAOs.
    Beside the web app, beyond the application context, but in the same physical server, there are some processes, kind of batch processes that update tables and that kind of stuff, that run once a day. Theese processes are plain Java classes, with a main method, that are executed from ".sh" scripts with the "java" command.
    What do I need to do?
    "Simple". I need one of those Java processes to use one of the web app's service. This service has some DAOs injected by Spring. And the service itself is a bean defined in the Spring configuration file.
    The solution is made-up of 2 parts:
    1. I created a class, in the web app, with a static method that returns any bean defined in the Spring configuration file, or in other words, any bean in the application context. In my case, this method returns the service I need.
    public class SpringApplicationContext implements ApplicationContextAware {
         private static ApplicationContext appContext;
         public void setApplicationContext(ApplicationContext context) throws BeansException {
              appContext = context;
         public static Object getBean(String nombreBean) {
              return appContext.getBean(nombreBean);
    }The ApplicationContext is injected to the class by Spring through the setApplicationContext method. This is set in the Spring configuration file.
    Well, this works fine if I call the getBean method from any class in the web app. But that's not what I need. I need to get a bean from outside the web app. From the "Java batch process".
    2. Why doesn't it work from outside the web app? Because when I call getBean from the process outside the web app, a different class loader is executed to load the SpringApplicationContext class. Thus, the static field appContext is null. Am I right?
    So, the question I need you to please answer me, the question I didn't find in Google:
    How can I share the static field between the 2 class loaders?
    If I can't, how can I load the SpringApplicationContext class, from the "Java batch process", with the same class loader my web app was started?
    Or, do I need to load the SpringApplicationContext class again? Can't I use, from the process, the class already loaded by my web app?
    I' sorry about my so extensive post...
    Thank you very much!

    zibilico wrote:
    But maybe, if the web service stuff gets to complicated or it doesn't fulfill my needs, I'll set up a separate Spring context, that gets loaded everytime I run the "Java batch process". It'll have it's own Spring configuration files (these will be a fragment of the web app's config files), where I'll define only the beans I need to use, say the service and the 2 DAOs, and also the DB connection. Additionally, I'll set the classpath to use the beans classes of the web app. Thus, if the service and DAOs were modified in the app server, the process would load the modified classes in the following execution.You'll almost certainly have to do that even if you do use RMI, Web services etc. to connect.
    What I suggest is that you split your web project into two source trees, the stuff that relates strictly to the web front end and the code which will be shared with the batch. The latter can then be treated as a library used by both the batch and web projects. That can include splitting Spring configuration files into common and specific, the common beans file can be retrieved from the classpath with an include. I regularly split web projects this way anyway, it helps impose decoupling between View/Controller and Model layers.
    On the other hand, you might consider running these batch processes inside the web server on background threads.

  • Array static int help

    static int[]      insert(int x, int i, int[] a)
    insert takes an item x, an index i, and an array a, and returns a new array containing all the elements of a with one additional element, namely x, at position i.
    ok im trying to add 2 ints to the array?
    and i dont understand what im doing wrong this is what i tried and it says error bc it needs an int in the return.
    its suppose to do this
    a = new int[3]; a[0] = 5; a[1] = 2; a[2] = 7;
    a.length3
    b = insert(-42, 1, a); // -42 is passed into x and 1 is passed into i
    b.length4
    b[1]-42
    b[2]2
    this is what i have written that is wrong...
    public static int[] insert(int newZ, int newX, int[] a){
    int totals = 1;
    int z = newZ;
    int x = newX;
    for (int i = 0; i < a.length; i++){
    totals = (a[i]+ z + x);
    return totals;
    }

    Hi,
    This forum is exclusively for discussions related to Sun Java Studio Creator. Please post your question at :
    http://forum.java.sun.com/forum.jspa?forumID=54
    Thanks,
    RK.

  • How to javadoc enum values

    Did some search but did not found an answer on how to javadoc enum values. For example if I want to describe the values 'first' and 'second'?
    * Some enumeration
    public enum Enumm {first, second};
    Should it be done like this???:
    * Some enumeration
    public enum Enumm {first /**Desc for first*/, second /**Desc for second*/};

    Should it be done like this???:
    * Some enumeration
    public enum Enumm {first /**Desc for first*/, second
    /**Desc for second*/};Close, but no cigar.
    It's a little more like this:
    public enum EquipSlotType {
    /** A type of ornamental jewellery around a finger. */ RING;
    }

  • Code standard for get/set or static int?

    What is the standard for getting setting values in a class?
    ie.
    static int VALUE = 0;
    String[] values = new String[1];
    public void set(int in, String val){
         values[in] = val;
    public String get(int in){
         return values[in];
    }OR
    String val1;
    String val2;
    public String getVal1(){
         return val1;
    public void setVal1(String in){
         val1 = in;

    I would say the first is Very Bad, and the second is Good. In-between is Bad, which would be storing everything in a Map, where at least the values are named rather than having an anonymous number to identify them.
    With that said, where I work we actually have a class that uses the Bad solution that I outlined, but it's designed to be exposed publicly by subclasses using the standard getter/setter idiom, and the map itself is not used externally. So instead of being backed by variables, all the getters and setters are backed by a Map. It ends up being Not So Bad. :-)

  • How to view my final ebill after porting numbers?

    Does anyone know how to view my final bill?  When I ported my five telephone numbers two weeks ago to AT&T and Verizon deactivated my online account.  I still receive emails telling me my bill is ready to view online but I cannot log in, it tells me its an inactive phone number. 

    Thank you, but I was enrolled in e-billing and received an email that my bill was available online.  But cannot access it.

  • How to export from Final Cut Pro after downloading Maverick

    Final Cut Pro no longer exports after installing Maverick.  I get this: The operation couldn’t be completed. (com.apple.Compressor.CompressorKit.ErrorDomain error -1.)  - have paid for Compressor and instaled it - but it makes no difference.

    But how do I update Final Cut Pro 10.0.3?  Apple says all my updates for everything are fine.  It worked well before I installed Maverick, and now I can't get any of my short films out of it!  They won't copy over to IMovie so I have to start again and basically scrap Final Cut Pro - which seems a bit unfair just for updating to Maverick.  Makes the free download a bit pricey in the long term.

Maybe you are looking for