The document contains a simple Java program that defines a 'calculator' class with an 'add' method to compute the sum of two integers. The 'demo_cal' class contains the main method which creates an instance of the 'calculator' class and calls the 'add' method with the values 20 and 30. The result of the addition is printed to the console.
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0 ratings0% found this document useful (0 votes)
3 views2 pages
10 2
The document contains a simple Java program that defines a 'calculator' class with an 'add' method to compute the sum of two integers. The 'demo_cal' class contains the main method which creates an instance of the 'calculator' class and calls the 'add' method with the values 20 and 30. The result of the addition is printed to the console.