Prasanna Choudhary

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

Recent posts by Prasanna Choudhary

Hi Ram

We can have number of catch blocks, but only one finally block...
So its like

try{
...
}
catch1{....}
catch2{....}
....
catchn{....}

finally{
.....
}

Thanks
Sorry guys!!!

I didn't use object concept at all.

How could I forget that
Hi

I am getting compile time error at line 1

code:

class CheckString
{
public static void main(String... a)
{
String makingString()
{//line 1
.....
.....
.....

}
}
}


CheckString.java: ';' expected
String makingString()
^
1 error

Please help me with this.
Thanks in advance.
Which of the following statements are true?
1.To be overridden a method must have the same name, parameter types and return type
2.It is possible to override methods in a superclass or the same class
3.classes that are marked as final may not be extended. - true
4.an overriding method cannot have more access (be more public) than the method being overriden.

Anvi,

1. The overridden method must have the same name, parameter types. It can have the same return type or covarient types.
2. Its not possible to override methos in the same class
3. ....
4. class X{
String aMethod(){System.out.println("In Super class");}
}

class Y extends X{
private String aMethod(){System.out.println("In Super class");} //gives error as the access is restricted
}


Thanks
The continue in the loop stops the execution of current iteration and goes to the next iteration.
When the iteration starts, it checks for the condition in the loop and if follows the execution of the loop if the condition is satisfied. If the condition is false, it won't enter into the loop and can't execute that statement.

Hope this is clear....
The switch can hold a variable of an int compatibls primitive.