java error_please help me | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

java error_please help me

https://www.sololearn.com/Profile/16081840 it does'nt run please help me

8th Dec 2020, 6:02 PM
Hanane
Hanane - avatar
2 Answers
+ 2
Observe 3 comment I made. That's the difference. Commented package statements. Creation of "fo" object is wrong.. //line no : 3, 16, 21
8th Dec 2020, 9:30 PM
Jayakrishna 🇮🇳
+ 3
Share the code link here.. Ok. User defined Packages are not in SoloLearn And you are using 'Class' instead of 'class2'. Corrected code : //برنامه20 //package javaapplication6; import java.util.Scanner; public class JavaApplication6 { public static void main(String[] args) { Scanner o=new Scanner(System.in); int x; double y; System.out.print("enter x :"); x=o.nextInt(); System.out.println(); System.out.print("enter y :"); y=o.nextInt(); System.out.println("\nx="+x+"y="+y); class2 fo = new class2(); //correct one fo.Mohasebe(x,y); System.out.print("\nx="+x+"y="+y); } } //package javaapplication6; public class class2 { public void Mohasebe(int a,double b){ System.out.println("\na="+a+"b="+b); a*=5; b/=5; System.out.println("\na="+a+"b="+b); } }
8th Dec 2020, 7:13 PM
Jayakrishna 🇮🇳