Granny's Programming Pearls
"inside of every large program is a small program struggling to get out"
JavaRanch.com/granny.jsp

atin sehgal

Ranch Hand
+ Follow
since Nov 12, 2000
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by atin sehgal

Hi all,
It seems this online study group is not working.
I havenot got any replies nor have I recvd any mails.
I am coming up with a olution.
those of u who r intrested in forming a group, pls do mail me.
at :
saggi_78@yahoo.com
I will send u a all a confirmatory mailk as soonas I get any mail from yr side.
Happy SCJP Certification hunting
regards
Hi all,
Whats the progress guys.
Hey my name is being spelt wrong in the Drop Down box .Itshd Atin Sehgal.
Alsdo the thing is not working too.
regards
Hi Dave!

So when r u planning to start online study group.
I wd like to join that.It wd b a great thing since we can share our queries problems and also study side by side.

Plz do inform me on that thru mail:
saggi_78@yahoo.com

Waiting for yr mail
regards

Hi Dave,
I am atin from India , with almost the same objective like u.
---->To Clear Sun certification with aleast 80%
I am using both Khalid and Simon robert.
Tell u frankly, I had first purchased Simon roberts , but I still had some doubts since I was able to score easily in the review question and I was getting over confident as well.

So I got this khaild book and man this book is omething.It has excellent set of review question , mucg tougher than real exam so the level of questions are tough which help in yr preparation....

But on the whole , Simon robert is easy to study because its in a simple and lucid language.But for questiona and additional practice , i suppose khalid is the best
Abt yr 4 th point---> Are there people out there who are at the same stage that I am willing to form a study group where we could share thoughts and exchange tricks, answers, etc. ?

Where r u going to form study group.Online one or what?
I wd like to b associated with such a group.
regards.

How 2 is false some one please eplain..
i dont get it.
If by this question he is reffering to the method that can be clled or is he simply means abt GC..

Plz reply....
You got me confused over this man.
But I suppose and think that goto and const are reserved words, which are keywords too...Better check JLS also.
and one more thing abt strictfp which is newly added in java2.So if we are asked to state the number of keywords shpuld we include goto,const and strictfp or not?
Strictfp is keyword.No doubt over that.
So the answer in jexam wd say only strictfp..

2)Select all valid java Keywords.
1)superclass--Nope
2)goto --yep
3)open--nope
4)close ---nope
5)integer ---nope
6)goto, import --yep
7) superclass, open, close --nope

Hi!
According to me the following shd be the answer
5) true-->GC always runs in low memory situation .
4) false-->The garbage collector reclaims an object�s memory as soon as it becomes a candidate for garbage collection.
There is no surity if GC will ever run even if object is a candidate for Garbage collection
3) Not sure-->The garbage collector informs your object when it is about to be garbage collected.
Am not sur whether it will be true.
2) True-->You can directly run the garbage collector whenever you want to.i think we can call system.gc() method but whether the object will be garbage collected is not a surity...
1) False-You can directly free the memory allocated by an object. Not possible in java..GC does this work.
Hope this helps...

Help me abt my doubts...
regards..
Yep and No...
A top level class/interface has to be public.
if u try to compile a top level class with access modifier as default or say protected it gives error..
But if a class is not top level class then it can be protected/default....
Hope I am right.
But abt top level thing I am sure that it has to be public..Cannot be any other thing..

Originally posted by Sagar Sharma:
can classes have access specifier other than 'public' and 'no specifier - friendly' specifiers


Nope,
One was there on card though which just was a basic.But none on Html.
Better go thru awt very well.i scored 0 in awt had 3 on awt.though I was 100% confident in awt..
I too think answer shd be E-None of the above.
Bcoz we can never be sure if we notify(), which of the thread may be notified..
Thats why its is preffred to use NotifyAll()

Correct me if I am wrong...
Regards..
Hi!
class abc /* this class will compile even if the file name is
different from source file name*/
//class firstdefault /8I saved the file earlier as firstdefault.java/.Then changed the name to a different source name.Still it compiled...*/
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}
Oops , I tried yr program , but it never ran , it compiled ok , but gave error at run time..
I tried the above program, in which I first compiled a class as firstdefault and saved it.It ran and compile...perfectly..
Then I renaed the class name as abc and saved as first default.java.
i compiled again , it compiled.
then it ran..
Thats why i quoted those things..
Plz suggest where I was wrong.i might be wrong too.
Hi!
There are a few things which i think I shd share with u first so that i am able to convince u.
1) The mofdifier.The modifier here is defaulty ansd not public.
2) Classs level whether top level or anyother..
If the modifier is public and class is top level its a necessary condition that for compiling that
a) Source Name shd be same as class name
For efficient running(no run time error_)
a) Main method shd b perfect.

Now the case of yr example..
Your class has no access modifir => it translates to friendly or default access.
Hence the condition for efficient compiling in this case is that
1) source file != name of class file.
they can be different.. and yet compile.
For running the condition ois :
That main method shd be correct..
Feel free to touchbase if any query.
I am attching a program that i have done today itself...

//top level class with default access modifier.Class compiles.It will not compile only when main method is not perfect
class abc /* this class will compile even if the file name is different from source file name*/
//class firstdefault//I saved the file earlier as firstdefault.java/.Then changed the name to a different source name.Still it compiled...
{
public static void main(String[] args)
{
System.out.println("Hello World!");
}
}

/* So conclusion...if a class file is having default access modifier , we can compile the class successfully
a) Even if source name different...from class name.
Runs successfully
a)only if main is absolutely correct.

Plz revert in case of doubt or anything wrong abt my code...
at atin_sehgal@hotmail.com

Originally posted by bhakti soman:
hi
i have compiled this code
class bhatki
{
public static void main(String arg[])
{
}
}
saved it as demo.java works fine with me.
that means you need not save file same as that class which contains main mehod.
please help me if i am wrong.


Hi!
can anyone tell me why this program is giving compiler error..

class staticvartest1
{
//static int x;
public static void main(String[] args)
{
static int x=10;//This is causing error
x=x+1;
System.out.println("Hello World!");
System.out.println(x);
}
}
}
However this program runs...
class staticvartest1
{
static int x;
public static void main(String[] args)
{
//static int x=10;
x=x+1;
System.out.println("Hello World!");
System.out.println(x);
}
}
}
gives output of 1

<marquee>Plz help me.......</marquee>