Thursday, 15 August 2013

java - Edited program showing result for an earlier program -



java - Edited program showing result for an earlier program -

i ran simple calculator programme functions such add-on , multiplication , programme gave required results. after give-and-take on here, tried edit code after running project still giving me errors before program. commented code before program.

please find both programme below , kindly tell me doing wrong. after changing values programme still gives same result.

public class calculator { public static void main(string[] args) { int = 6; int b = 5; // int c; // c = addition(a,b); //calling method , passing values , b system.out.println(addition(a, b)); } public static int addition(int a, int b) { // int c; // c= a+b; homecoming + b; } } // gives result of 11

the code works fine, didn't compile programme before running it. if using eclipse enable automatic build in eclipse menu: project -> build automatically or compile in command line:

javac calculator.java java calculator

java netbeans-7

No comments:

Post a Comment