In this task, you are going to create a StringObject class. And make it implement the SimpleObject interface using a String parameter. And, of course, the program must also run and compile. Let's go!
SimpleObject interface
- 8
Locked
Comments (10)
- Popular
- New
- Old
You must be signed in to leave a comment
Jonaskinny Java Developer at Sandmedia
26 February 2022, 23:14
I ended up implementing an actual Singleton then failed, realized once again it has to be exactly what they say, nothing more no matter what, and I forgot :0
0
ImDevin
2 June 2021, 23:42
This task is basically a repeat of 1307 and I think either this task's solution is wrong or 1307's. I couldn't pass this task because, initially, I didn't include <String> after SimpleObject; but it passed after I put it in.
public static class StringObject implements SimpleObject<String>
Well, in 1307, I didn't include <String>, but passed it. I think CG had an incorrect solution in 1307, if <String> is supposed to follow the method name.
+2
Baurzhan Konurbayev
5 August 2020, 00:26
I hope there will be Generics learning section, where I can gather all the pieces of puzzles. Right now I completed task intuitively.
0
Facundo Villarroel
4 January 2020, 15:10
So far I've been okay with the new concepts about interfaces and abstracts classes. But for some tasks, I was able to actually do the right this without fully understanding why I was doing it. And this task is a really good example of that. In this case I was really lost and was able to make it pass by reading the help section for this task.
I really don't want to just continue doing it this way because I'm basically not fully getting the concepts. Actually, just yesterday I went through the whole section again from start, to reinforce the concepts and try to drill them in my head, but apparently it didn't work, as I really don't understand this task. Can someone point me in the right direction on what are the concepts that I need to understand that this tasks touches? Would really appreciate it! TIA
+3
Liliane Top
15 March 2020, 16:12
I have exactly the same feeling. I just wonder which part am I missing to be able to do these tasks. For the last tasks I found the answer in the help section but do not fully understand it either.
Were you able to find better information about how this works in regards to getting a better understanding of abstract classes and their implementation and @Override, etc ??
+1
Jonaskinny Java Developer at Sandmedia
26 February 2022, 23:02
for everything, all of the J2SE stuff, start with this its verbatim for java 8, correct, concise, and complete. Then you can branch out Java Tutorial Trail
0
Jen P
28 July 2019, 20:29
Is this problem related to generics ?
+1
Julián Orellana
12 September 2018, 00:11
please help, what is wrong
public class Solution {
public static void main(String[] args) throws Exception {
SimpleObject<String> stringObject = new StringObject<String>();
}
interface SimpleObject<T> {
SimpleObject<T> getInstance();
}
public static class StringObject<String> implements SimpleObject<String> {
public StringObject<String> getInstance(){
return this;
}
}
}
0
Roman
12 September 2018, 05:44
If you need help, something isn't right in your code, the server won't accept your solution (even if you are 100% sure that it is correct). Describe your question/issue in the HELP section at codegym.cc/help.
0
Jonaskinny Java Developer at Sandmedia
26 February 2022, 23:00
no this in the context of your code if running. this refers to the surrounding instance of the class its contained in. where is the instance?
0