Hi how do i create a final variable string and send in one parameter to it

public static string POISON_PILL = new string("AAA");
when i do this it gives me an error highlighting the 'new string("AAA"); '

error msg: initalizes a new instance of the system.string class to the value indicated by an array of unicode characers.

does anyone have any idea ??

appreciate a reply
thanks

Recommended Answers

All 4 Replies

i get an error saying:

Error 1 The best overloaded method match for 'string.String(char[])' has some invalid arguments 11 44 PF

Error 2 Argument '1': cannot convert from 'string' to 'char[]' 11 55 PF

You don't need to explictly call a constructor for a string. Infact, there is not a constructor for String that takes a String as an argument. All you need to do is:

public static string POISON_PILL = "AAA";

ok
thanks but how do you declare final

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.