So ... I'm browsing the web today for Java and I already have a big project at work. I am used for PHP and C ++, so I have not been so troubled to learn this language, but I have been trapped in that question.
I have a multi-dimensional array in that pattern: My question is: How can I set my way to accept such an array (above) and I How can I read that multi-dimensional array (Bila)? Public zero getArray (string [] data) {println (data ["data"] ["name"];} Example: Code> "John", "age" =>, "16")); // to Return: 'John' - See: Sorry if this is a dumb question, I really do not have any knowledge in Java. But to know, I really have to answer that question. Thanks in advance. PHP arrays are not actually arrays, they are ions. You should also look in classes, because non-PHP programmers usually talk like this: then: Plus, you get type protection compile time to know about the problems, it's great because you instead deploy them before deploying the application can do.
Hashmap
class person {name of private string} ; Personal gaps ages; Public person (string name, int era) {this.name = name; This.age = age; } Public string getName () {this.name; } // etc}
class SomeClass {public static zero main (string [] args) {person person = new person ("John ", 16); Hashmap & lt; String, person & gt; People = new hashmop & lt; String, person & gt; (); People.put (person.getName (), person); Classes can make things a lot easier for large projects, because they can not hold the values only:
class person {personal string} first name; Personal string last name; Public person (string first name, string last name) {this.firstName = firstName; This.lastName = lastName; } / ** * Gives the full name (first and last name) to no person, it stores it internally as a separate variable * / public string getName () {return.firstName + "" + this .lastName; } Public string getFirstName () {return this.firstName; } // etc}
No comments:
Post a Comment