Question :You can create a String object as String str = "abc"; Why cant a button
object be created as Button bt = "abc";? Explain (CoreJava)
Answer :The main reason you cannot create a button by Button bt1= "abc"; is
because "abc" is a literal string (something slightly different than a String
object, by-the-way) and bt1 is a Button object. The only object in Java that
can be assigned a literal String is java.lang.String. Important to note that
you are NOT calling a java.lang.String constuctor when you type String s =
"abc";
www.interviewhelper.org is a hope for all the Job seekers. Users can find unlimited here. These range from technical to HR, from functional to behavioral. www.interviewhelper.org contains in the fields like Ajax,VB,Networking,Sharepoint,JEE,Perl,Javascript,Bioinformatics,Classic ASP,Unix,Linux,Accounting,Oracle DBA,Microprocessor,Bluetooth,jms,jme,.net framework,ABAP,ASP,ASP.net,Basic .net Framework,Interview Questions,C language,C++,database,Oracle,Java,PHP,LAMP,SAP etc.
Thursday, March 12, 2009
You can create a String object as String str = "abc"; Why cant a button
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment