Please solve the error ..where iam lacking | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Please solve the error ..where iam lacking

https://code.sololearn.com/c2dNKvDh6VSb/?ref=app

13th Mar 2021, 3:10 PM
Sufia Hashmi
Sufia Hashmi - avatar
3 Answers
+ 3
It's Me You can't work with user defined package on Sololearn. https://code.sololearn.com/cTtAo3RlP458/?ref=app
13th Mar 2021, 3:31 PM
A͢J
A͢J - avatar
+ 2
Whats package hashmi? you cannot import package in sololearn
13th Mar 2021, 3:16 PM
Sharique Khan
Sharique Khan - avatar
+ 2
The following runs in Sololearn Code Playground: public class Y { public int arr[]={10,9,3,1,6,5,4,8,2,7}; public int sortedarr[]=new int [10]; public void get() { int temp; for (int i=0;i<9;i++) { for (int j=0;j<10-i-1;j++) { if (arr[j]>arr[j+1]) { temp=arr[j]; arr[j]=arr[j+1]; arr[j+1]=temp; } } } } } public class Z { public void disp(int arr[]) { System.out.println("sorter lists are:"); for (int i=0;i<10;i++) { System.out.println(arr[i]); } } } class Sortinglist1 { public static void main(String args[]) { Y obj=new Y(); Z obj1=new Z(); obj.get(); obj1.disp(obj.arr); } } Try to read the error messages better next time. The error message pointed out the problem. Here is the message: "./Playground/Z.java:3: error: class, interface, or enum expected package hashmi; ^ 1 error"
13th Mar 2021, 3:18 PM
Josh Greig
Josh Greig - avatar