Win a copy of Rust Web Development this week in the Other Languages forum!

Priya Chetlur

Greenhorn
+ Follow
since Feb 20, 2001
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 Priya Chetlur

Hi Kanchan,
I think the explanation to this can be found in the following link:
http://java.sun.com/docs/books/jls/second_edition/html/lexical.doc.html#100960
Hope it helps,
Priya
Hi Sunil,
JLS very clearly says that a return statement with no expression can be used in a method with void keyword or in the body of a constructor. But if used within an instance initializer or a static initializer results in a compilation error. A return statement with an expression must be contained in a method declaration that is declared to return a value or a compile-time error results.
Check this link: http://java.sun.com/docs/books/jls/second_edition/html/statements.doc.html#6767
Hope it helps,
Priya
Hi Farhan,
You can take a look at the following link: http://java.sun.com/docs/books/jls/second_edition/html/statements.doc.html#5894
Hope it helps,
Priya
Hi Marc,
The rules applicable for the conversions here in your example are:
1) Conversions from char to int are always valid as they are widening conversions.
2) Conversions from int to char obviously require an cast as they are narrowing conversions.
3) Implicit narrowing conversions occurs from int to char in two cases:
--> When the int literal is in the range of the char (0 to 65535)
--> If the int variable is declared as final and its value is in the range of char (0 to 65535).
So,
int i=100;
final int j=200;
char c='c';
i=c; //valid - widening conversion
//c=i; //compile error - requires cast as it is narrowing conversion
c=100; //valid - implicit conversion of the int literal 100 to char
c=j; //valid - j is a final variable
Hope this helps,
Priya
Hi All,
I am having trouble starting and running the J2EE server. I have windows 98. I have set the path variable to C:\j2sdkee1.2.1\bin. I have also set the environment variables J2EE_HOME and JAVA_HOME. When i issue command cloudscape -start, the following is dispalyed and nothing happens after that. I mean it doesn't come back to the prompt.
----------------------------------------------------------------
C:\j2sdkee1.2.1>cloudscape -start
Thu May 31 18:20:19 SGT 2001: [RmiJdbc] COM.cloudscape.core.JDBCDriver registere
d in DriverManager
Thu May 31 18:20:19 SGT 2001: [RmiJdbc] Binding RmiJdbcServer...
Thu May 31 18:20:19 SGT 2001: [RmiJdbc] No installation of RMI Security Manager.
..
Thu May 31 18:20:19 SGT 2001: [RmiJdbc] RmiJdbcServer bound in rmi registry
----------------------------------------------------------------

Where as when i issue the command j2ee -verbose, the following is displayed:
-----------------------------------------------------------------
C:\j2sdkee1.2.1>j2ee -verbose
J2EE server Listen Port: = 1049
Naming service started: :1050
Published the configuration object ...
Binding DataSource, name = jdbc/Cloudscape, url = jdbc:cloudscape:rmi:Cloudscape
DB;create=true
org.apache.tomcat.core.DefaultServlet: init
org.apache.jasper.runtime.JspServlet: init
Web service started: 9191
org.apache.tomcat.core.DefaultServlet: init
org.apache.jasper.runtime.JspServlet: init
Web service started: 8000
Web service started: 7000
J2EE server startup complete.
----------------------------------------------------------------

I want to know what this means. Has the J2EE server started properly. Why does it get stuck when i start cloudscape? Can anyone please diagnose the problem and suggest a solution.
Thanks in advance,
Priya
Hi Alex,
Can you please suggest me some good books on those topics.
Thanks in advance,
Priya
Hi Everybody,
I recently finished my SCJP with 93%. I am interested to take the SCJD exam. I have some basic questions about the exam.
1) Is there a time limit for completing the assignment? How long does it usually take to finish it?
2) What are the concepts one needs to cover to be able to finish the assignment. Please suggest some good books on those topics.
3) Does one need to go deep into design techniques?
Thanx in advance,
Priya
Hi Thiruna,
All the best for your exam. Have you taken Marcus greem test1? There are some great questions on threads in the first mock test. Marcus green tutorial on threads is also quite good. They really help to understand the concept better. Even JQ+ has quite many questions on the topic.
IO, i feel u just need to be good at the basics. Just be very good at the basic input and output streams, readers and writers...especially their constructors. I don't think the test is going deep into these topics.
Inner classes i found the chapter in Khalid Mughal very good. You should basically know how they can be declared, whether they can have static or non-static members, the access modifiers they can have, how they can be instantiated, their access to the members of the enclosing context and all that.
What i felt was the exam tests you on the bare basics. But there are some tricky questions which you can answer only when all those basics are internalized into you. Read the questions carefully. Take your own time. There is more than enough time. I finished the test in 70-80 minutes. Then i revised the answers twice. Be careful about questions which look like they are testing you on a topic, but they might be actually testing you on some other concept.
All the very best once again,
Priya
20 years ago
Hi Everybody,
I passed SCJP today with 93%. I got 55 out of 59 questions correct. I want to thank javaranch and everybody who posts topic here. Though i rarely participated in the discussions, i used to go through the posts regularly. It was very very useful for my preparation.
Thanks again,
Priya
20 years ago
Hi,
I too tried that. I overloaded the method with a StringBuffer argument. It then gives a compilation error. When there is a relation between the classes of the arguments ie., a superclass subclass relation, then it seems to select the method with the subclass argument (itseems that the compiler considers the subclass argument more specific than superclass). But when there is atleast one class which is not related, then the compiler complains that it is ambiguous.
Anyone with another explanation for it?
Consider this question from Abhilash's site:
public class AQuestion
{
public void method(Object o)
{
System.out.println("Object Verion");
}
public void method(String s)
{
System.out.println("String Version");
}
public static void main(String args[])
{
AQuestion question = new AQuestion();
question.method(null);
}
}
The program prints "String Version". I know that the method() is overloaded and the compiler in case of ambiguity selects the method which is most specific. How is the compiler coming to the conclusion that the null argument is most specific to the String parameter? Help anybody.
Thanks in advance

Hi,
In the code the control directly goes to the case 2. It doesn't go to case 1. In case 2 you are just assigning the value 30 to the already declared and initialized varible j. So how come the declaration of the int j in case 2 valid?
Consider the following code:
public class sample
{
public static void main(String args[])
{
int i=2;
switch(i)
{
case 1:
int j=10;
break;
case 2:
//j=30; //line 1
System.out.println(j); //line 2
break;
case 3:
int k=40;
break;
}
}
}
The code doesn't compile and says that the variable might not have been initialized. But if i uncomment line 1 it compiles fine and prints the value j. Line 2 doen't declare the variable, it initializes it. This means that the compiler accepts the declaration of j in case 1 as valid in case 2. But why doesn't it accept the initialization of the variable? I am not quite able to understand this. Can anybody please explain to me?
Hi All,
Can a string literal have comments in it? JLS 3.7, it is mentioned as follows:
-------------------------------------------------------------
The lexical grammar implies that comments do not occur within character literals (�3.10.4) or string literals (�3.10.5).
-------------------------------------------------------------
But the following program compiles and runs perfectly:
class Test
{
public static void main(String args[])
{
String str1="This is a /*comment*/ string literal";
String str2="This is a //comment string literal";
System.out.println(str1);
System.out.println(str2);
}
}
Am i missing something?
Thanks in advance.
Thanks, it is clear to me now.