Raj Hans

+ Follow
since May 10, 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 Raj Hans

Originally posted by Rashmi Trivedi:
Hi Guys
I am preparing for SCJP exam and plannig to appear in the exam sometimes next month. I have almost finish upto ch 8 and got little confused with my self about how ch 9 to 12 are important in SCJP exam....
Ch 9 is Layout Manager
Ch 10 is Events
Ch 11 is Components
Ch 12 is Paiting...
I have decided not to study ch 12 coz it is very boring....
So guys can u tell me or highlight the main topic in above chapters which i can concentrate rather than studying whole chapters.....
I appreciate your time and consideration...and looking forward to hearing from u shortly....

Hi Rashmi,
Chapter 12 ..Painting.
Basically if you just look at the couple functions used by the Graphics Object like:
g.drawRect(..), g.fillRect(..)
and get the basics of what is a Clipping Region?
Then you should be all set with that Chapter.
I had one question on the AWT Painting in the Exam?

Originally posted by Paulo Silveira:
Hi guys
I am taking the exam next monday.
I am really prepared.... but sometimes I get scared about some questions that appear on mock exams...
IO and AWT... how are the questions? In some Mocks, I see MANY API questions, like if a RandomAcessFile can delete the file that it is referencing (can not) and how is the hierarchy of some IOs, if objectinputstream implements interface A or subclass class B...

are these kinda question for real?
I dont like these.
What about StringBuffer? I ve seen also for the String class, if the .substring(int) method returns the right part or left part.
Does anyone hae a good mock that really represents IO and AWT?
thanks a lot

Kind of Questions that I came across during my exam..
1. Constructor for FileInputStream?
2. Valid access options for RandomAcessFile?
3. Can BufferedInputStream be constructed using FileName?
1. Use of CheckGroup?
2. Clipping Region of a Component?
Wanted to let you guys know that I just passed my SCJP (97%). Thanks to all you guys. This Newsgroup did make the Test a lot easier than I thought it would be.
Thanks again
21 years ago

Originally posted by pradeep bhat:
Can a method with no access modifier be overriden by a method marked protected?
Java ranch says it is True.
But I say it is "false".
A method can over ride another method if its access modifier is same or less restrictive than the overriden method.
Some one plz clarify.

The method with no modifier is more restrictive than the method marked protected..
// supper class
package sample;
public class testObj
protected void tstMethod(int i){

//sub class
package sample;
class tstObj2 extends sample.testObj
void tstMethod (int i) {


error in subclass : access modifier more restrictive.

Originally posted by Gautam Sewani:
I have some queries related to RandomAccessFile:
1.What is the need for the class RandomAccessFile when we have FileInputStream and FileOutputStream?
2.The following code produces strange results:
RandomAccessFile raf=new RandomAccessFile("Io.java",rw);
raf.writeUTF("This has been written by RandomAccessFile");
When I execute thid code and open the Io.java file,then it has the following text:
"(This has been written by RandomAccessFile" without quotes.
Now why is there a bracket before the text??
3.When the same program is executed using the method writeChars(),then Io.java contains the following information:
"T h i s h a s b e e n w r i t t e n b y R a n d o m A c c e s s F i l e"
Why is there a space between each character?
4.When we call the seek method of the RandomAccessFile,where does the next read/write operation take place,at the new Position or after the new Position?
5.Can a RandomAccessFile object be closed?

1. RandomAccessFile is useful for non-sequantial read/writes.
2. The bracket comes for the part conversion of your string to UTF-8
3. Your text when converted to UTF-8, the high bit empty and set to space, hence u see spaces b4 each character
4.read and write can start from location u specify in the method, could from the current pointer location, from the beginning, or and offset from the pointer location (remember RAF is used for no-sequential read/write)
5. YEs