423,832 Members | 1,902 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 423,832 IT Pros & Developers. It's quick & easy.

Can you create A button object as Button bt = "abc" ;? If yes, how?

P: 2
When you’ll create A String Object As String Str = “abc”; Why can’t A Button Object be Created As Button Bt = “abc”;? Justify.
5 Days Ago #1
Share this Question
Share on Google+
1 Reply

P: 3
You can’t create a button by Button bt= “abc”; is because “abc” is a literal string (something slightly different than a String object, by-the-way) and but maybe a Button object. The only object in Java that may assign a literal String is java.lang.String. Important to note that you aren’t calling a java.lang.String constructor once you type String s = “abc”;
4 Days Ago #2

Post your reply

Sign in to post your reply or Sign up for a free account.