Java own Variables


I’m relatively new in creating own data types? in Java. For example i want to make a variable, which contains a String and a number.

public StringNumber(String st, int number) {

With this Code I can make something like this:

StringNumber sn = new StringNumber(“test”, 0);

My Problem is, that i don’t know how I can get the String out of it, like


Ty for reading and eventually helping ^^

Nvm i found out how it is working