What is mean 'Container a=new getContentPane()" ?
A:
I don't think this is valid code. According to this Sun tutorial, the new
keyword requires a constructor call as its argument, i.e. something like Rectangle()
; a class name followed by a list of arguments (optional). Your code doesn't have this, instead it has a regular method call.
unwind
2009-03-20 07:40:42
Technically, nothing prevents you from having a class named "getContentPane"
Michael Borgwardt
2009-03-20 07:43:58
A:
A variable named 'a' of type Container is declared and assigned a new Object of class getContentPane.
Since 'getContentPane' violates the Java naming conventions for classes (which ascribe a capitalized first letter) and is also a prominent method name in Swing frames, it's probably a mistake and results in a compiler error.
Try removing the "new" to call the method rather than constructing an object.
Michael Borgwardt
2009-03-20 07:43:18