| Author |
compile time error.
|
Madan Mohan
Ranch Hand
Joined: Dec 05, 2008
Posts: 30
|
|
sorry frends...
i wrongly printed the code ....the code is as follows
import java.io.*;
public class SerializationDemo{
public static void main(String args[])
try{
MyClass object1 = new MyClass("Hello",-7,2.7e10);
System.out.println("Object : " +object1);
}
catch(Exception e){
System.out.println("Exception during serialization : " +e);
//System.exit(0);
}
}
class MyClass implements Serializable{
String s;
int i;
double d;
public MyClass(String s , int i, double d){
this.s=s;
this.i=i;
this.d=d;
}
public String toString(){
return "s=" + s + "; i=" + i + " ; d=" +d;
}
while compling this is giving me an error msg " ; expected"
can anyone catch where the error is occuring...
|
 |
Punit Singh
Ranch Hand
Joined: Oct 16, 2008
Posts: 952
|
|
Use Code tag always.
Write down these lines in a main() method.
|
SCJP 6
|
 |
Madan Mohan
Ranch Hand
Joined: Dec 05, 2008
Posts: 30
|
|
Hey punit,
i wrongly printed the code...could you now tell me where the error is?
many thanks
|
 |
Punit Singh
Ranch Hand
Joined: Oct 16, 2008
Posts: 952
|
|
Again you did not use code tag
I have solved your problem, only { brackets were missing just copy paste your code.
|
 |
Madan Mohan
Ranch Hand
Joined: Dec 05, 2008
Posts: 30
|
|
ohh i amm so sorry for not using code. thanks for the help.
thanks a ton
|
 |
 |
|
|
subject: compile time error.
|
|
|