Rippon Jalali

Greenhorn
+ Follow
since Aug 25, 2006
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 Rippon Jalali

I downloaded tomcat6.0 from the website.after starting tomcat,when i log on to
http://localhost:8080(i am using 8080 port for this).It is showing me the congratulation page saying i have successfully setup tomcat.But when i click on tomcat manager ,it doesn't ask for username and password.And directly shows me the 401 ERROR.Error is as:>

type Status report
message
description This request requires HTTP authentication ().


Apache Tomcat/6.0.13
16 years ago
Thanks for all of your help.
17 years ago
"sorry the previuos one had a mistake".I am repeating again.But even if you throw exception other than general 'Exception' like 'ClassCastException'.Still it doesn't catch that exception.
17 years ago
but even if you throw exception other than general 'Exception' like 'ClassCastException'.Still it doesn't throw exception.
17 years ago
As the calls to "STRING ".toUpperCase() == "STRING" does not change anything, the reference to the orignal unchanged string in the pool is returned.
17 years ago
but when we are comparing string literals there is no need of equals method.As when we run the code below.it gives output "Equal".
if("String".toString() == "String")

System.out.println("Equal");

else

System.out.println("Not Equal");
17 years ago
the below given code gives "Not Equal". But as trim() returns a string whose value is string used to invoke the method but with any leading or trailing blank spaces removed. So isn't the condition result in true and output be "Equal"?

if(" String ".trim() == "String")

System.out.println("Equal");

else

System.out.println("Not Equal");
17 years ago
when i am trying to run below program.the output comes='0'.
BUt shouldn't it come '1'.


public class t {
public static void main(String argv[]) {

int i =0;

i=i++;
System.out.println(i);
}


}
17 years ago
But as shown in the simple program below,never a exception can be thrown in try block.BUt prog compiles fine and runs


public class t {
public static void main(String[] args) {
int i = 2;
try {
i=9;

} catch (Exception ae){
System.err.println(" exception caught");
}
System.out.println(i);
}
}
17 years ago
But whenver we write a try catch block.It is not necessary that exception will occur .It may or may not occur.
The error comes:
t.java:7: exception java.io.IOException is never thrown in body of corresponding
try statement
}catch(IOException ioe){}
17 years ago
when i run the program below it gives compiler error saying that myref.test() does not throw exception.but as i know it is not necessary that the code should throw the exception


import java.io.*;
public class TechnoSample {
public static void main(String[] args) {
TechnoSampleSub myref = new TechnoSampleSub();
try{
myref.test();
}catch(IOException ioe){}
}
void test() throws IOException{
System.out.println("In TechnoSample");
throw new IOException();
}
}
class TechnoSampleSub extends TechnoSample {
void test() {
System.out.println("In TechnoSampleSub");
}
}
17 years ago
i checked it for:
if(array instanceof int[]).
it is working .And ofcourse the answer should be (4).Thank you for your response
17 years ago
actually the question was like this
# instanceof operator can be used with ...

1. interfaces
2. Arrays
3. Classes
4. All of the above

so should answer be the (4)
17 years ago
i want to ask a question that whether we can use instanceof operator with arrays?
17 years ago
The problem in the code below is that catch clause in the called method rethrows exception,and main method neither handles nor declares the exception.So shouldn't it give compiler error?but it isgiving answer 3.
Can any body explain.

public class Test3{
public static void main(String args[]){
System.out.println(method());
}
public static int method(){
try{
throw new Exception();
}
catch(Exception e){
throw new Exception();
}
finally{
return 3;
}
}
}
17 years ago