File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

correct these ??

 
sasank manohar
Ranch Hand
Posts: 186
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator


* Runnable interface have only one method that is run()
* equals() method checks for only object types

* Garbage collection algorithm in java is vendor implemented

* A class inside a method can only have access to final variables.
* Strings are implemented as a class for which java overloads the + operator.
* To get the size of an array u must use the lenght property of an array ( array-var.length)
* To get the size of a String or StringBuffer objects u must use the length() method.
( string_var.length(), stringbuffer_var.length())
* The instanceof operator can be used to determine if a reference is an instance of a particular primitive wrapper class.
* The instanceof operator will always return ture if you ask if a reference is an instance of the object class.
* Interfaces can't contain constructors.

* Interfaces can't be instantiated.
* Constructors may be overloaded but can't be overriden.
* constructors can be declared private.

* Anonymous class can't have a constructor.
* A collection for storing bits as on-off information like a vector of bits.
* Collection is the root interface in the collection hierarchy
* Set and List interfaces extends from Collection interface.
* List is an ordered list and does allow duplicates( it can have more than one null element) , and search for elements in the list is by their integer index.
* Set is a unordered collection and does not allow duplicates
 
sasank manohar
Ranch Hand
Posts: 186
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone whether these right or wrong!!!
 
Khurram Fakhar
Ranch Hand
Posts: 65
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well many of them r RIGHT
 
Ken Lai
Ranch Hand
Posts: 30
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Just to clarify...
>> * A class inside a method can only have access to final
>> variables.
This is true for variables defined in the method or variables that are passed in to the method as parameters.
For a class defined in:
a) a non-static method - the class can access all variables in the enclosing class, not just final variables
b) a static method - the class can access only static variables in the enclosing class.
Please correct me if I got it wrong.
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Ken- exactly right.
As for the others: right, except for these:
* equals() method checks for only object types
If you mean that the equals() method only works for Objects, not primitives, then yes. Otherwise I'm not sure what this means.
* The instanceof operator will always return ture if you ask if a reference is an instance of the object class.
Not if the reference contains a null. Otherwise true.
* Anonymous class can't have a constructor.
It can't define a constructor, but it can use a constructor from the class it's overloading.
<code><pre> class A {
public A(String name) {
System.out.println("This instance is named " + name);
}
public void method() {
System.out.println("old method");
}
}

class Test {
public static void main(String[] s) {
A a = new A("Anonymous") {
public void method() {
System.out.println("new method");
)
}
a.method();
}
}
</pre></code>
* A collection for storing bits as on-off information like a vector of bits.
??? No idea what this means. Collections are for many things; a Vector of bits is just one possibility.
* Collection is the root interface in the collection hierarchy
I suppose so, by definition. But you should be aware that Map is not in this hierarchy.
 
thomas
Ranch Hand
Posts: 79
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
* Anonymous class can't have a constructor.
It can't define a constructor, but it can use a constructor from the class it's "overloading".
Jim, you meant "extending", right?
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • 0
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops. Right, thanks.
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic