Dear All,
I think this page has error or I misunderstand the topic
http://www.javapassion.com/handsonlabs/javabuiltinclasses/index.html#Exercise_1
*Free Java Programming with Passion! Online Course
-> 2. Learning the basics of Java language
-> Working with built-in Java Classes
-> Exercise 1: Create an object instance of a built-in class using
"new" keyword (20 minutes)
-> (1.1) Create String object instances using "new" keyword*
Where it is mentioned the following in *Code-1.11: ClassAndObject.java*
// String class a special class for which you can create an instance
// of it by assigning a string literal. *No other class allows this
form of object creation*.
String strInstance2 = "I am object instance of a String class";
System.out.println("value of strIntance2 = " + strInstance2);
But I found that *Wrapper classes do allow object creation* by assigning to
literal as follows:
Integer x=10, y=20;
Integer z = x+y;
System.out.println(z);
Please let me know if I missunderstand this topic.
Thank you,
Belal Marzouk
--~--~---------~--~----~------------~-------~--~----~
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/javaprogrammingwithpassion?hl=en
-~----------~----~----~----~------~----~------~--~---