aspose file tools*
The moose likes Programmer Certification (SCJP/OCPJP) and the fly likes compile time error. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


Win a copy of The Java EE 7 Tutorial Volume 1 or Volume 2 this week in the Java EE forum
or jQuery UI in Action in the JavaScript forum!
JavaRanch » Java Forums » Certification » Programmer Certification (SCJP/OCPJP)
Bookmark "compile time error." Watch "compile time error." New topic
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
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: compile time error.