Create a generic class with variable called same as your name. Create two objects of this class which will have different variable types. print their values.
We don’t do people’s homework (or whatever) for them on this site. This is a learning site. If you have code that you’ve tried or aren’t sure about, then please share it and we can take a look.
public class>implement Pair
(
private n name;
private s surname;
public
this.name=name,
this.surname = surname,
)
public n getName()(return name)
public s getSurname()(return surname)
)
I’m not a Java guy - hopefully someone will pipe in.
This line:
Create a generic class with variable called same as your name.
The wording seems a bit odd here so I’m not 100% sure what this means, but I don’t see a generic class, regardless of the name. Do you understand what a generic class is?
This topic was automatically closed 182 days after the last reply. New replies are no longer allowed.