This week's book giveaway is in the Java in General forum.
We're giving away four copies of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 and have ishori Sharan & Adam L Davis on-line!
See this thread for details.
Win a copy of Beginning Java 17 Fundamentals: Object-Oriented Programming in Java 17 this week in the Java in General forum!

vidhya Ramachandran

Greenhorn
+ Follow
since Sep 15, 2000
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 vidhya Ramachandran

I am a SCJP now and absolutely delighted with the result.
Many thanks to Javaranch !
I prepared for two months full time. I mainly used RHE,Exam Cram, Java API. I did all the mocks on Maha's site. Thanks Maha.
Difficulty level of the exam was intermediate.
AWT - 4
IO - 6
UTIL - 5
LANG - 2
THREADS - 6
OVERRIDING - 5-6
OVERLOADING - 5-6
FLOW CONTROL - 3
OBJECT CASTING,CONVERSION - 4
Also, lots of questions on language fundamentals, Strings, StringBuffer. A few questions on the default value for variables and References. Most questions had 8 lines of code. I got a few questions with upto 20 lines of code. Threads was tough, I got only 71% in Threads. The Thread discussions in Javaranch and Maha's site helped me. Atleast 15 questions had confusing options.
Goodluck to future aspirants .
Thanks for your wishes. The duration of the exam is 90 min. Well, I finished the exam in 50 min. I had ample time to review all the questions.
[This message has been edited by vidhya Ramachandran (edited November 08, 2000).]
[This message has been edited by vidhya Ramachandran (edited November 08, 2000).]
Yes it did compile when I changed to
import java.awt.event.*;
class s extends java.awt.Frame{

import java.awt.*;
class s extends Frame{
s(){
addWindowListener(new WindowAdapter(){
public void windowClosing(WindowEvent e) {
System.out.println("Anonymous Inner Class");
}});
}
public static void main(String args[]){
new s();
}
}
I am getting compiler error for the above code. Any idea why.
-------
s.java:10: Class WindowAdapter not found.
addWindowListener(new WindowAdapter()
-------

Why does the given code produce runtime exception w.r.t the constructor ?
-----------
import java.applet.Applet;
import java.awt.*;
public class Sample extends Applet {
private String text = "Hello World";
public void init() {
add(new Label(text));
}
public Sample (String string) {
text = string;
}

}

Can somebody give an eg for the following:
1.Forward references to variables gives compiler error.
2.Instance initializer(s) gets executed ONLY IF the objects are constructed.
Checkout the CD supplied with the book. It has the answers.

Using "default" as a java identifier causes compiler error.
Also "default" is listed as a keyword. Where is it used ?

Please read the following from JLS. Hope this answers your question:

Because Unicode escapes are processed very early, it is not correct to write '\u000a' for a character literal whose value is
linefeed (LF); the Unicode escape \u000a is transformed into an actual linefeed in translation step 1 (�3.3) and the linefeed
becomes a LineTerminator in step 2 (�3.4), and so the character literal is not valid in step 3. Instead, one should use the
escape sequence '\n' (�3.10.6). Similarly, it is not correct to write '\u000d' for a character literal whose value is carriage
return (CR). Instead, use '\r'.

You cannot make a static reference to nonstatic variable i.

In 1. "t" has to be defined as String.
Actually if the exception was not caught (there is no corresponding catch block), only the finally block will be executed. The output is:
3
java.lang.ArithmeticException: / by zero
at test3.main(test3.java:8)
Exception in thread "main" Process Exit...

[This message has been edited by vidhya Ramachandran (edited September 22, 2000).]

fill specifies how to let the component expand to fill any extra space.
So, I think the answer is 1.

System.out.println(Boolean.getBoolean("TRUE"));
System.out.println(Boolean.getBoolean("true"));
outputs
false
false
Any idea why ?