Not asking for help on my code, since I've already looked at the solution. I just need someone to explain the solution. Also, since the board doesn't handle greater-than or less-than symbols well, please interpret all parentheses as being greater-than or less-than.
What is (T) in the interface declaration? T is not declared anywhere in the code, so what is it? The conditions say to use a String parameter, so why isn't it interface SimpleObject(String)?
Other questions I need answered:
1. In the solution, they use @override. Why?
2. Why does it return null?
3. In the interface declaration, why is it SimpleObject(T) getInstance? I've never seen an interface refer to itself in the method, and I don't understand what doing that does.
4. I've been going through previous lessons trying to find examples of declaring interfaces this way, or related to my other questions. This task feels like it's all stuff we haven't been taught previously. If there is a lesson that explains these please let me know so I can reread it.
package com.codegym.task.task13.task1307;
/*
Parameterized interface
*/
public class Solution
{
public static void main(String[] args) throws Exception
{
}
interface SimpleObject<T>
{
SimpleObject<T> getInstance();
}
class StringObject implements SimpleObject<T>
{
public SimpleObject<T> getInstance()
{
}
}
}