• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

correct these ??

 
Ranch Hand
Posts: 186
  • 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
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can anyone whether these right or wrong!!!
 
Ranch Hand
Posts: 65
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Well many of them r RIGHT
 
Ranch Hand
Posts: 30
  • 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.
 
Wanderer
Posts: 18671
  • 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.
 
Ranch Hand
Posts: 79
  • 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
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oops. Right, thanks.
 
knowledge is the difference between drudgery and strategic action -- tiny ad
Building a Better World in your Backyard by Paul Wheaton and Shawn Klassen-Koop
https://coderanch.com/wiki/718759/books/Building-World-Backyard-Paul-Wheaton
    Bookmark Topic Watch Topic
  • New Topic