• 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

why am I getting verify error ???

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

/*Exception in thread "main" java.lang.VerifyError: (class: Tree, method: main si
nature: ([Ljava/lang/String; )V) Expecting to find unitialized object on stack*/

[This message has been edited by Jim Yingst (edited February 15, 2000).]
 
Desperado
Posts: 3226
5
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Because Tree1 is a static nested class, the instantiation
"Tree.Tree1 t1=new Tree().new Tree1(); "
is not appropriate. The standard and more clear way of doing it is
Tree.Tree1 t1 = new Tree.Tree1();
You must be using JDK 1.2.2. I understand that 1.3 Beta does not do that.
 
Wanderer
Posts: 18671
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Adding to what Tony said: although new Tree().new Tree1() is unnecessary for a static class, it isn't actually wrong - the fact that you get an error here is a bug in 1.2.2. I can confirm that 1.3 beta works correctly here.
Incidentally, you can also change your original program to remove "static" from the declaration of Tree1 (but keeping the "new Tree().new Tree1()"), and then everything works fine, even under 1.2.2.
 
Have you no shame? Have you no decency? Have you no tiny ad?
a bit of art, as a gift, that will fit in a stocking
https://gardener-gift.com
reply
    Bookmark Topic Watch Topic
  • New Topic