Eric Lidell

Greenhorn
+ Follow
since Jul 02, 2003
Merit badge: grant badges
For More
Cows and Likes
Cows
Total received
In last 30 days
0
Forums and Threads

Recent posts by Eric Lidell

How do i make a method in my class deprecated ?
is there any qualifier for it ?
How does my compiler know its a deprecated method ?
21 years ago
Hi,
does anybody know of any website where i can find good,FREE material on servlets ,JSP,JDBC and struts?
Preferrably pdf,ps or txt.
21 years ago
Thanks a lot for the replies.
I understand the scenario for when post and get do occur.
i wanted a scenario where they process the same logic.
Thanks a lot.
I thought there would be some advantage in calling.
I guess there isnt
21 years ago
Hi,
I wrote SCJp 1.4 and scored 95%.
I used Java Ranch's mock exam list and Dan Chisholm mock exam site mostly.
And Java Ranch played a large role in resolving my doubts.
Thanks a lot to the Java Community here and to others mainting mock exam sites and to SUN for developing a great PL.
21 years ago
The service (ServletRequest request ,ServletResponse response) is used to override the genericservlet.and it transfers the code to service (HttpServletRequest,HttpServletResponse ) by probably inserting the following code.
service((HttpServletRequest) request,(HttpServletResponse)response)
21 years ago
The basic convention in servlets extending HttpServlet is define one of the methods doGet or doPost (in case both happen to have the same processing logic) and call the other from inside the container called one.for eg:
class myservlet extends HttpServlet{
public void doGet(HttpRequest req,HttpResponse resp){
lots of code
}
public void doPost(HttpRequest req,HttpResponse resp){
doGet( req,resp);
}

}
Thats the above convention.My question is which is advantageous?
Defining code inside doPost and calling doPost from doGet request or defining code inside doGet and calling doGet from doPost ?
and Why?
is there any thumb of rule or justification for it?
21 years ago
Look at the following question i picked up in the internet.
public class Vertical {
private int alt;
public synchronized void up() {
++alt;
}
public void down() {
--alt;
}
public synchronized void jump() {
int a = alt;
up();
down();
assert(a == alt);
}
}
if the code is run with assertions enabled ,what are the possible answers?
a.The code will fail to compile.
b.Seperate threads can execute up() concurrently
c.Seperate threads can execute down() concurrently
d.Seperate threads can execute both up() & down() concurrently
e.the assertion wont fail under any circumstance.
What is the possible answer and the reason?
But why does the compiler show error for interface l and not for y?
class x{
interface y{}
class m{
interface l{}
}
}
if i replace the same code as follows
class x{
interface y{}
static class m{
interface l{}
}
}
it works fine.
Whats the reason?
why is an interface within a nested class implicitly static ?
any reason why?
21 years ago
Are interfaces implicitly static ?
class x{
interface y{}
class m{
interface l{}
}
}
While compiling this code,i am getting a message saying that interface l is implicitly static.but no error for interface y.
what is the meaning of static when applied to classes and interfaces?
for the matter ,what is the meaning of final when applied to innner classes?
21 years ago
So the nested class in an interface conforms to sense 2,cant be changed.
What does cant be changed mean when applied to a class?
will the members be final and methods be final???
21 years ago
Vector is a legacy class which has been added to collections and ArrayList is a collections.
The main difference is Vector class is synchronized and Arraylist isnt.
However u can get a synchronized version of ArrayList using the static functions in Collections.
21 years ago
Hi,
The members of a interface are implicitly public static and final.
if i declare a class within a interface ,is it public static and final too.
this code compiles correctly.
interface iface{
class class1{}
class class2 extends class1{}
/* shouldnt class1 be final because in an interface all the members are public ,final and static*/
}
class k{
public static void main(String args[])
{
iface.class1 x=new iface.class1();
/*this implies that the nested class is static */

}
}
Pls reply asap.
21 years ago
Thanks a lot guys for the replies.They solved my problem.
Thanks ,Ernest.
21 years ago
Pls look at the following code
class D {
public static void main (String[] args) {
char a=\u0030;
char b=\u0031;
char c=\u0032;
char y=\u0039;
/* the values from \u0030 to \u0039 are working fine when assigned char variable without the necessary '' ( i mean '\u0031').However ,usage of \u0001 to \u0029 and \u0040 and greater give a compile time error.
what is the reason? shouldnt the assignment be illegal??? */
System.out.println(""+a+b+c+y);
}
}
Pls clarify !
21 years ago
Thanks Joel.
Btw,What does your motto mean?
21 years ago