Guys i need help to solve this code.sub=oops with Java in week 12th program. question is : interface segrigetion | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Guys i need help to solve this code.sub=oops with Java in week 12th program. question is : interface segrigetion

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

12th May 2023, 7:19 AM
Punith Puni
Punith Puni - avatar
5 Answers
+ 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
12th May 2023, 8:04 AM
Ausgrindtube
Ausgrindtube - avatar
+ 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.
12th May 2023, 7:35 AM
Ugulberto Sánchez
Ugulberto Sánchez - avatar
+ 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?
12th May 2023, 10:32 AM
Orin Cook
Orin Cook - avatar
+ 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.
12th May 2023, 9:23 AM
Sakshi
Sakshi - avatar
+ 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.
12th May 2023, 1:17 PM
Bob_Li
Bob_Li - avatar