Can Multidimensional Arrays how two different types in them within java -


Is there a multi-dimensional array in Java that has two types of string and double in it?

Like: {name, num}, {name, num}

Zoyed is right, that this should be done with a class here is a more complete example.

  class MyClass {private string name; Private prime number; Public MyClass (string name, int number) {this.name = name; This.num = num; } Public string getName () {return name; } Public int getNum () {return num; }} Mikalas [] array = new Mycollus [5]; Array [0] = new MyClass ("name1", 5); Array [1] = new MyClass ("name2", 8); ...  

If the name or number needs to be changed after the original creation, then you can add the setters for them.


Comments

Popular posts from this blog

Editing Python Class in Shell and SQLAlchemy -

import - Python ImportError: No module named wmi -

uislider - In a MATLAB GUI, how does one implement a continuously varying slider from a GUIDE created .m file? -