+ 1
In this java code i have this error "uncked call to add(e) as a number of the raw type java.util.list". How to resolve it?
s_emps.add(new Emp("Bill", "bill@oracle.com",4000, getADate(2011,3,24,9,0) )) ; s_emps.add(new Emp("Gary", "gary@oracle.com", 5000, getADate(2007,2,24,9,0) )) ; s_emps.add(new Emp("Jeff", "jeff@oracle.com", 5500, getADate(2003,2,19,9,0) )) ; s_emps.add(new Emp("Joe", "joe@oracle.com", 4000, getADate(2012,2,13,9,0) )) ; s_emps.add(new Emp("Shay", "shay@oracle.com",6000, getADate(2002,2,21,9,0) )) ;
31 odpowiedzi
+ 4
Link for others:
https://code.sololearn.com/cgMe0zgoB1YI
Emps doesn't have properties or super to call so line 11 to 13 isn't needed.
+ 3
Without all the code, no. My suggestion makes that piece compile cleanly. It is the best that can be done without all of it.
+ 3
You provided the Emp class, but there isn't a main function.
https://code.sololearn.com/cjmwVidYEEH0
+ 2
Your array list needs to accept Emp types. Line 18 s_emps = new ArrayList<Emp>();
+ 2
The only thing you have public is code I've seen. Where is the definition of the Emp class. You also need a main function and maybe other functions to make use of your classes.
+ 1
I would assume you are adding objects of a class Emp to your list. Make sure your list declaration shows this. Say:
List<Emp> s_emps = new ArrayList<Emp>();
+ 1
ok. thanks
+ 1
before you can add items to arraylist, you need to declare it. Example:
ArrayList<String> = new ArrayList<>();
i asked you that how did you declare the s_emps arraylist?
It should be declared in one of the following two ways.
ArrayList<Emp> = new ArrayList<>();
or
List<Emp> = new ArrayList<>();
+ 1
Sure. You can insert a link to it in your post or you can insert it in a comment
+ 1
I can take a look at it but where is it?
+ 1
Did you keep getting an error after you declared the list the way we said?
+ 1
Do you know how to use Code Playground? If your code is there it will be easier for us to look at it and help you
+ 1
Make it public. I will be able to see it on your profile. You can make it private again later if you want
+ 1
Saw it. I will take a look at it
0
what errors are there can you tell me?
0
is there anyway that I can send you my complete code?
0
ok
0
now can anyone rewrite my code?
0
I shared it on my post?
0
sorry for question mark.