Anup Engineer

Ranch Hand
+ Follow
since Mar 04, 2002
Merit badge: grant badges
For More
Cows and Likes
Total received
In last 30 days
Total given
Total received
Received in last 30 days
Total given
Given in last 30 days
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Anup Engineer

I passed- 94
So family..will see you all in IBM-XML or SCJD..thanks!
20 years ago
bad solution:
import java.util.Hashtable;
public class InnerNotStatic {
static String keys[];
static String names[];

static Hashtable makeHash(String start) {
class myHash extends Hashtable {
public myHash() {

public void buildHash(String str) {
for (int i=0; i<keys.length; i++) {
if( names[i].startsWith( str )) {
put ( keys[i], names[i]);

myHash h = new myHash();
h.buildHash( start );
return h;

public static void main(String[] args) {
InnerNotStatic inner = new InnerNotStatic();
keys = new String[] {"k1","k2","k3","k4","k5"};
names = new String[] {"starting", "startup", "nothing", "toy", "boy"};
Hashtable hashtable = new Hashtable(10);
for(int i=0; i<keys.length; i++) {
hashtable.put(keys[i], names[i]);
Hashtable hashTemp = new Hashtable(10);
hashTemp = makeHash("start");
I made the variables and method as static.
A good solution would be to provide accessor and mutator methods for keys and names of the InnerNotStatic class. By the way, your InnerNotStatic is not a Inner Class?? or may be I didnt understand your question!
I read the API, but couldnt understand it clearly. Could you give me simple example of how natural ordering works in the Comparator class pls?
Some observations:
1) Native methods cant be defined abstract
2) With the same logic, an interface cant have Native methods, as it will be an abstract-native illegal combination
3) Native can be static, private or synchronized
1) Abstract methods cant be Synchronized. Basically, a method being Synchronized is an implementation level detail, so it wont go with the abstract keyword
2) With the same logic, an interface cant have a synchronized method, cause it will be a synchronized-abstract illegal combination
One aside:
Interfaces cant have static methods. I would like to have your ideas on this. What I thought was: lets say I wanted to define an interface called Counter. This counter should provide Increment() and Decrement() methods (static, cause I want to count the number of objects created)..
Obvious I cannot have
interface Counter{
static void Increment();
static void Decrement();
and then..
interface SheepCounter extends Counter{
void Increment(){}
void Decrement(){}
etc....then how do I force my classes to have certain static methods? Or I just cant?
Thanks a lot for reading this long boring post
This is abt the String class constructor.
String class doesnt have a constructor taking a character as an arg, so a statement like
String s='c';
Now when I did this:
public class StringCharacterTester{
public static void main(String args[]){
String s="\u00a1";
//String s1='c';
It compiled.
It printed chacater 'i'.
I was a bit surprised why would java accept this.
I think Sun's explanation makes more sense, because its in the user's hand to turn the assertions "off".
Interesting..! I ll like to know this too..anyone?!
No, I dont think they r going to list this exam on the site..I had to call up the 1-800 number given with the confirmation email..and they got me registered on the phone..
Hey All,
I am planning to take the Beta test like many of us here. My question was, even if the objectives are pretty much the same as what we have for SCJP2, there will be many subtle changes in the material we have been studying..for example, "assert" is not a keyword...and i m sure there will be quite a few other keywords/concepts..
So do we study the 1.4 APIs, make a note of these changes..? Has anyone prepared any material on this line...?
Can I get one too? Please email me at
Any of you guys having a copy...please, I have exams coming up soon.
Thanks a million!
Hello, I can almost say this is my second day on XML certification.
I tried searching the ranch for basic info, but couldnt clear my first doubt. Do i take both 140 & 141 exams to be xml certified? (are there even two exams, cause ibm doesnt have anything called 140 on their site).
I was thinking of starting with Professional XML & XML Bible, do I need both? or just Prof. XML would be ok?
Thanks for taking the time
When exactly do we say there is an is a relationship?
question from a mock:
Where will be a 'is a' reln
A. interface Person
class Employee implements Person
B. interface Shape
interface Rectangle extends Shape
C. interface Component
class Object implements Component
{Component[] Component;}
Ans given is B.
I thought all were in 'is-a' relations, cause "implements" also counts as 'is-a'.