java - I am having issues with this constructor and getting a compiler error -


This is a very easy program:

Make a method for the calculation class that will take two numbers And add them together (use square variables for this!). For an additional challenge, create more than one class method for this: Create a method for taking the numbers into one class method and the second to display the results of the calculation, by displaying the contents of a class variable, Which keeps counting results. Make a main method that will declare an object in the calculation square and use all the methods of that category.

This is what I have taken up, but it will not give me any value in the calculator class because I do not have constructors, yet I have the method in controller management. Please help

  public class manakakal {/ ** * @ ultimate command line argument * / public static zero main (string [] args) {calculator calcOne = new calculator (); System.out.println ("Calcons equivalent:" + Calcone. Calculator ()); } Class calculator {Private intrate number 1; Private intranet number 2; Public Ent Answers; Public Zero getNum (int i, int j) {num1 = i; Num2 = j; } Calculation of public int () {answer = num1 + num2; Answer to return; }}}}    

you want

  Public void public calculator (int i, int j) { )   

  

Not a return type and otherwise essentially to keep it simple, as a class with the same name. Please see for more information.

And similarly, create two values ​​calculator.

  New calculator (1,2);    

Comments

Popular posts from this blog

Verilog Error: output or inout port "Q" must be connected to a structural net expression -

jasper reports - How to center align barcode using jasperreports and barcode4j -

c# - ASP.NET MVC - Attaching an entity of type 'MODELNAME' failed because another entity of the same type already has the same primary key value -