Prasanna Joshi

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

Recent posts by Prasanna Joshi


Can anyone tell the major difference between XML and HTML
and how they are related
Hi Friends
I passed with 90 %
Special thanks to Maha Anna for her guidance
Book I referred
-Roberts and Heller
Other Sources
-Marcus tutorial
-Dylan Walsh Tutorial
-Java Prepare Tutorial
-Raji Swaminathan Tutorial
-Java Ranch Forum
Many mock test's But the Best of them are the 3 Marcus Mock Tests

The Best site for all possible mock Links with their weightage
is Maha's Site www.javaranch.com/maha/
Bye
Prasanna
Hi Friends
I passed with 90 %
Special thanks to Maha Anna for her guidance
Book I referred
-Roberts and Heller
Other Sources
-Marcus tutorial
-Dylan Walsh Tutorial
-Java Prepare Tutorial
-Raji Swaminathan Tutorial
-Java Ranch Forum
Many mock test's But the Best of them are the 3 Marcus Mock Tests

The Best site for all possible mock Links with their weightage
is Maha's Site www.javaranch.com/maha/
Bye
Prasanna
Overloading and overriding are both examples of polymorphism.
But Overriding is a perfect example of Runtime Polymorphism.
An example can illustarte this
interface A
{
public void method();

}
class B implements A
{
public void method()
{
System.out.println("Method of A");
}
}
class C implements A
{
public void method()
{
System.out.println("Method of C");
}
}
public class Test
{
public static void main(String[] args)
{
A a ;
B b = new B();
C c = new C();
// now see this
a = b;
System.out.println(a.method());
//will print method of A
now a = c;
System.out.println(a.method());
// will print method of C
}
Hence depending upon the object the methods are invoked

}
}
I first read the question and concluded the ans to be
"how strange" then compiled and found to be correct.
Following was my thought process
The inner class "inner" has no independant identity of it own
ie it has to have a outer class handle in order to be constructed hence on a new inner()inside the test constructor outer "inner" class is called
to construct inner "inner" class we may have to do
new test().new inner();
Now in order to prove it I tried to construct an object in the
main() method as new test().new inner(); but was unable to do so.
Can anybody help!!
In javadoc --
Waits for this thread to die.
Practically a use of join is to block until the thread
completes it operation ie if u start a thread in main()
and u want the main to block until the thread completes
it operation.you can use join,so when the thread completes
it run ie dies,it unblocks the execution of main()
eg public static void main(String [] args)
{
Thread t = new Thread();
t.start();
t.join();
}
}
1 false
--The objects are eligible for gc,the statement deleted
makes me feel it is wrong,although it is a ambiguous q
2.false
--You have to override the finalize() method in order for it
to be invoked.
3.true
--The java document says,the finalize() method is never invoked
more than once by a JVM for any given object.
4.true
--The gc checks if a refernce is still valid/asociated with a variable.
5.false
--The catch here is the "will" statemnet.You cannot say for sure
which algorith may be used.Although it also is a bit ambiguous

AWT : MenuItem extends MenuComponent extends Object
Exceptions :
The Object thrown by a throw statement must be assignable to the Throwable type.This includes the Error and Exception types.
Basics :
The "goto" and "const" are keywords which are reserved by Java
"true" and "false" are technically boolean literals
"null" is technically a null literal.
IO :
InputStream and OutputStream are byte Oriented
Reader and Writer classes are character Oriented

[This message has been edited by Prasanna Joshi (edited July 05, 2000).]
I have a small suggestion.I have observed in this list that
a same set of Tricky Questions from various Mock Exams Crop
up again and again.Shall we make a list in this thread
of all the Tricky Questions/Questions related to fundamentals
we find,without repeating any of them so that we have a consolidated list of Questions Also, We should put only the hardest questions and their answers.Also if we have to discuss about any of the questions in this list ,we should do it in a different Thread ,so That this thread does not get Cluttered.
To start The Thread I add a question I felt tested your fundamentals

Q 1)
class ApBase extends Object implements Runnable.
1. Apbase aBase = new ApBase();
2. Runnable aR = aBase;
3. Object obj = aR;
4. Apbase x = (Apbase)obj;
What will happen when we try to compile and run?
a. Compiler objects to line 2.
b. Compiler objects to line 3.
c.Code compiles but when run , throws ClassCastException in line 4.
d. Compiles and runs fine.
Answer --> D

Another Question
Q2
Which of the options below will print
running on the Command Line
1. class RunTest implements Runnable {
2. public static void main(String args[]) {
3. RunTest rt = new RunTest();
4. Thread t = new Thread(rt);
5. //A
6. }
7. public void run() {
8. System.out.println("running");
9. }
10. void go() {
11. start(1);
12. }
13. void start(int i) {
14. }
15. }
Select all valid answers.
a. System.out.println("running");
b. rt.start();
c. rt.go();
d. rt.start(1);
Ans--> a
[This message has been edited by Prasanna Joshi (edited June 30, 2000).]
[This message has been edited by Prasanna Joshi (edited June 30, 2000).]
Please tell me some good books /tutorials for swing
23 years ago
In one of the mocks/notes I came accross the sentence
"Local Inner Classes are not associated with an instance
of the outer (enclosing) class"
Could any one clarify the meaning of this??