+ 1

There is some error here... Can someone please let me know what should i do..??

class Calc { int num1; int num2; int result; public void perform() { result= num1*num2; } } public class Program { public static void main(String[] args) { Calc obj=new Calc(); obj.num1=5; obj.num2=4; obj.perform(); System.out println(obj.result); } }

7th Aug 2020, 3:09 PM
Himangi Singh
Himangi Singh - avatar
4 Answers
+ 1
You don't need getters and setters..... The problem is the missing dot at "System. out println"
7th Aug 2020, 11:01 PM
Victor Ukoha
Victor Ukoha - avatar
+ 10
Yeah you forget dot after System.out so it giving errors .
7th Aug 2020, 5:47 PM
A S Raghuvanshi
A S Raghuvanshi - avatar
+ 5
Well, there is in fact only a dot missing in "System.out.println", BUT (maybe you just started with your Java course, then this is only an advice what to look up additionally), please take a look at your usage of accessibility modifiers and getter methods...
7th Aug 2020, 3:14 PM
Sandra Meyer
Sandra Meyer - avatar
7th Aug 2020, 3:30 PM
JaScript
JaScript - avatar