• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Jeanne Boyarsky
  • Ron McLeod
  • Paul Clapham
  • Liutauras Vilda
Sheriffs:
  • paul wheaton
  • Rob Spoor
  • Devaka Cooray
Saloon Keepers:
  • Stephan van Hulst
  • Tim Holloway
  • Carey Brown
  • Frits Walraven
  • Tim Moores
Bartenders:
  • Mikalai Zaikin

what is printStackTrace()

 
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
import java.io.*;

public class first{

public static void main(String\u005B\u005D args){

try{

FileOutputStream fos=new FileOutputStream("Test.txt");
ObjectOutputStream oos=new ObjectOutputStream(fos);
first p=new first();
oos.writeObject(p);
}
catch(Exception e){
e.printStackTrace();
}

}

}
Dear ranchar when i am executing the following code i am getting NotSerializable exception well i know that i have to implements Serializable in my class first but i want to know about the printStackTrace() method as when i am executing the above code i am getting exception in the following way....

1 java.io.NotSerializableException: first
2 at java.io.ObjectOutputStream.writeObject0(Unknown source)
3 at java.io.ObjectOutputStream.writeObject(Unknown source)
4 at first.main(first.java:12)

Here i would like to know that why we are getting line 2 and 3 two times


Regard

Arun
 
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It calls writeObject and writeObject0, or is that your typo?
 
Arun Maalik
Ranch Hand
Posts: 216
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
no it is calling writeObject0() with zero
writeObject() without zero
 
With a little knowledge, a cast iron skillet is non-stick and lasts a lifetime.
reply
    Bookmark Topic Watch Topic
  • New Topic