Java String predefine -


i'm sure question has allready been answered somewhere, i' ve searched half hour , i'm running out of keywords, because have absolutly no idea how this.

i have constructor class

public myclass (string name) {} 

what want define strings strings can entered.

i assume has static final strings, there quite lot found , dont know how narrow down search. please tell me how thing want called, can search it.

edit: example want: want somehow define number of strings. (or somethig else has same effect, said dont know how it)

string 1 = "exampleone"; string 2 = "exampletwo";

so when call constuctor

myclass myclass = new myclass("somethingelse"); 

the constructor wont take it. or better eclipse allready showing options have whit "color. "

yes have right can not override string class because final can create own stringwrapper class wraps string.

public class stringwrapper{ private string content; public stringwrapper(string c){  content = c; }  //all methods , fields there, example delegated methods public string tostring(){      return content.tostring();   } } 

but enum used in case define enum values

public enum color {  white, black, red, yellow, blue;  //; required here.   @override public string tostring() {    //only capitalize first letter    string s = super.tostring();    return s.substring(0, 1) + s.substring(1).tolowercase();  } }  public myclass (color color) {} 

Comments

Popular posts from this blog

windows - Single EXE to Install Python Standalone Executable for Easy Distribution -

c# - Access objects in UserControl from MainWindow in WPF -

javascript - How to name a jQuery function to make a browser's back button work? -