Win a copy of Practical SVG this week in the HTML/CSS/JavaScript forum!
  • Post Reply Bookmark Topic Watch Topic
  • New Topic

need help debugging this code:

 
robincelena
Greenhorn
Posts: 2
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
public class DebugMe1
{
public void main(String [] args)
{
int a;
int result = method1(a);
System.out.println("The result of passing a to method1 is: " + result);
}
public int method1(int y)
{
int b = 2;
int a = b + method2(y);
return a;
}
public int method2(int z)
{
int c = z * 10;
return c;
}
}
/*debug this code. The output should be: "The result of passing a to method1 is: 32"
From the main method, call method1 and pass it the class-level variable.
*/
 
Marcela Blei
Ranch Hand
Posts: 477
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"robincelena",
your name is not valid as per the Javaranch name conventions. Please refer to the document located here
Also, your post doesn't belong to this forum so I will move it to: Java in general (intermediate) forum, look there, you'll find more answers to your doubt.
 
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!