• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Find errors

 
Mak Harry
Greenhorn
Posts: 1
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Pls. help me to explain what is wrong with this program and identify the number of iterations through the loop.

UBB code brackets added
[ April 18, 2003: Message edited by: Barry Gaunt ]
 
Barry Gaunt
Ranch Hand
Posts: 7729
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
The modifiers on the main method are wrong. It should be public static void main(String[] args).
Why not add a counter, and compile and run your program?
What happens when b is 127 and b++ is performed?
[ April 18, 2003: Message edited by: Barry Gaunt ]
 
Francis Siu
Ranch Hand
Posts: 867
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
hi Mak
Welcome
The modifiers on the main method are wrong. It should be public static void main(String[] args).

And identify the number of iterations through the loop.
In your main method

I hope that i can explain clear
 
Jim Yingst
Wanderer
Sheriff
Posts: 18671
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Also, you will want to study and understand the output from this code:

Try replacing "byte num" with "short num" or "int num" to see what happens.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic