0
Please solve the error ..where iam lacking
3 Réponses
+ 3
It's Me
You can't work with user defined package on Sololearn.
https://code.sololearn.com/cTtAo3RlP458/?ref=app
+ 2
Whats package hashmi? you cannot import package in sololearn
+ 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"