W
Wojtek
Lew wrote :
So it is limited to primitives or String. Ok, then what would you call
this? Like String it is barred from being modified after
initialisation.
--------------------------------
public class Foo
{
public static final MyObject OBJECT_SOME = new MyObject("some parm");
public static final MyObject OBJECT_TWO = new MyObject("two parm");
public class MyObject()
{
private String parm;
private MyObject(String parm )
{
this.parm = parm;
}
public String getParm()
{
return this.parm;
}
}
}
....
System.out.println(FoBJECT_SOME.getParm());
--------------------------------
What is OBJECT_SOME?
If there is a name for this, then that is what I will start calling
these constructs, otherwise...
That is not the definition of a class constant! The JLS defines the term.
It is an extremely important distinction; initialization of class constants
and their storage differs from other 'static final' variables.
You are not using the correct definition.
So it is limited to primitives or String. Ok, then what would you call
this? Like String it is barred from being modified after
initialisation.
--------------------------------
public class Foo
{
public static final MyObject OBJECT_SOME = new MyObject("some parm");
public static final MyObject OBJECT_TWO = new MyObject("two parm");
public class MyObject()
{
private String parm;
private MyObject(String parm )
{
this.parm = parm;
}
public String getParm()
{
return this.parm;
}
}
}
....
System.out.println(FoBJECT_SOME.getParm());
--------------------------------
What is OBJECT_SOME?
If there is a name for this, then that is what I will start calling
these constructs, otherwise...