How to assign one value to multiple variables

I want to receive one value, which represents multiple variables. for example I receive 110200john This value goes directly without any code to multiple variables like

int x = 11
double y = 0200
string name = john

How can I do that ?

Can I use enum

enum data {
 int x ;
double y ;
string name ;

}

Also I am receiving the value in byte format.

Thank you for your help guys

Jon Skeet
people
quotationmark

You should almost certainly create a class to represent those three values together, if they're meaningful. I'd personally then write a static parse method. So something like:

public final class Person {
    private final int x;
    private final double y;
    private final String name;

    public Person(int x, double y, String name) {
        this.x = x;
        this.y = y;
        this.name = name;
    }

    public static Person parse(String text) {
        int x = Integer.parseInt(text.substring(0, 2));
        double y = Double.parseDouble(text.substring(2, 6));
        String name = text.substring(6);
        return Person(x, y, name);
    }

    // TODO: Getters or whatever is required
}

This assumes that the format of your string is always xxyyyyname - basically you should adjust the parse method to suit, using substring and the various other parse methods available.

people

See more on this question at Stackoverflow