Krishna Mir

+ Follow
since Jan 09, 2006
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 Krishna Mir

Hi all,

I passed SCJP 5.0 yesterday and now I would like to focus on SCWCD. I need all the help you guys can offer so that I am on right track from the beginning.

1. Which is the best book that focusses on exam as well as on concepts.
2. Any tips for prepration for this exam.
3. Mock exams / free epractice exams etc..

I have seen a lot about this HFSJ book. Which book is this (cannot figure out abbreviation)??

Please let me know.

Thanks in advance.
HI All,

Passed SCJP 5.0 exam yesterday with 74%. Thanks to Kathy Seirra & Bert Bates for their wonderful books. Edition 5 book is much more focussed on exam when compared to 1.4. And ofcorse, thanks to this wonderful site and its members for helping novices like us.

Good luck to others who are preparing for the exam.

18 years ago

Are there any free epractice or mock exams for SCJP 5.0 edition, online??

Please let me know, if any.

When regular expressions are used as patterns to match the input strings, it results in groups of strings that have matched the pattern. These groups can be accessed using a back reference \n where n is the index of the group captured. I didn't understand the following table.

Whole content Regular expression Result

abab ([a-z][a-z])\1 Found the text "abab" starting at
index 0 and ending at index 4.

abcd ([a-z][a-z])\1 No match found

abcd ([a-z][a-z]) Found the text "ab" starting at
index 0 and ending at index 2.
and the text "cd" starting at
index 2 and ending at index 4

Can anybody please help me to undetstand above?

Thanks Kumar, I see the point.
Thanks everybody. I got the point.

Sure Mr.Bates. Here it is.


class Base
public String name;
public int age;

name = "Smith";
age = 20;

// System.out.println("Base: " + name + " " + age);


class Sub extends Base implements Serializable
public String color;

color = "Red";
name = "John";
age = 2;

//System.out.println("Sub: " + name + " " + age + " " + color);



public class ObjSerialTest
public static void main(String[] args) throws FileNotFoundException, IOException, ClassNotFoundException
Sub s = new Sub();

ObjectOutputStream save = new ObjectOutputStream(new FileOutputStream("datafile.txt"));


ObjectInputStream restore = new ObjectInputStream(new FileInputStream("datafile.txt"));
Sub b = (Sub) restore.readObject();

System.out.println( + " " + b.age + " " + b.color);

O/P is : Smith 20 Red

Question: How can I get: John 2 Red ?

Please see the following piece of code:


1. (String) => (String, Number[]) // why not (String, Integer[]) or (String, Object[])
2. (String, int) => (String, Number[]) // why not(String, Integer[])
3. (String, Integer) => (String, Number[]) // why not(String, Integer[])
5. (String, int, int) => (String, Number[]) // why not(String, Integer[])
7. (String, int, int, int) => (String, Number[]) // why not(String, Integer[])

My questions are in comments above.

[ February 05, 2006: Message edited by: Mark Spritzler ]
I read that certain primitives are always to be boxed into the same immutable wrapper objects and these objects are then cached and reused, with the expecation that these are commonly used objects. These special values are :
* boolean values true and false
* byte values
* short and int values between -128 and 127
* char values in range '\u0000' to '\u007f'

So should I assume that for boxing/unboxing, values of short/int/byte range between -128 to 127?

If thats the case, then why is the following TRUE when both are out of range?

Integer k=128;
int kk = 128;

Thanks in advance.
Hai there,

Even when a super class doesn't implement Serializable but the subclass does, only the super class member values are saved/restored after deserialization. Is there any way we can save the subclass member values (inherited ones)?

for example, super class has members name="Java";
sub class inherits name and but assigns name = "Cplusplus";

Is there any way I can restore the "Cplusplus" value of name?

I hope you all got my point. If unclear, let me know and I will try to make it more elaborate.

What is the use of having private member variables of an Abstract class when all its methods are also abstract?


abstract class Car
private double price;
private String model;

public abstract void goFast();
public abstract void goUpHill();
How can we access non overridden methods of anonymous inner class?