+ 1
Guys i need help to solve this code.sub=oops with Java in week 12th program. question is : interface segrigetion
5 Antworten
+ 7
Ugulberto Sánchez is right.
Why not do the Java Intermediate course here on Sololearn.
https://www.sololearn.com/learn/courses/java-intermediate
They provide this code example with an interface:
https://code.sololearn.com/csyQuOPkW9Sr/?ref=app
+ 4
I am not expert with java, but I think you cant make a class interface, and also implement it inside the class. Try to rewrite your code, it has so much errors.
+ 4
lots and lots of small mistakes, but the big conceptual one imo is that you have to EXTEND a parent class, and implement interfaces: class car extends toy implements move (no comma), for example.
Also, fix your indenting to make the code more readable.
other things:
parent and interface functions must either have {} or be explicitly declared abstract
red needs quotes, "red"
multiple closing } brace errors (again, fix your indenting to make this easier to keep track of)
there should be no dots in car c = new car() and plane p = new plane
plane should probably implement move if you're gonna give it a move method anyway?
+ 3
Punith Puni in your code several mistake you don't put setColor() and getColor() method use like that and you don't implement the classes correctly, Firstly learn java intermediate course like Ausgrindtube said then then practice on it.
+ 3
Punith Puni
You are cheating yourself when you ask others to do your homework for you.
Orin Cook pointed out the errors in your code.
I have posted the solution in the comments under your codebit.
But if you cannot find the errors by yourself, can you really say you know how to code? Real life codes are much harder than these.
Go slowly and redo the previous lessons. Get a firmer understanding of the basics. Further lessons will be much harder otherwise.