Can I pass a value to my own String-like class like this:
MyClass mc = "String";
Is it even possible?
views:
40answers:
2
+1
A:
public class MyClass {
private String str;
public MyClass(String str) {
this.str = str;
}
public static void main(String [] args) {
MyClass mc = new MyClass("This is the string");
}
}
Make sense?
Scobal
2010-07-15 10:34:03
+3
A:
No this is not possible as Java does not support operator overloading.
haffax
2010-07-15 10:34:15