mardi 7 avril 2015

How to implement a public class, including some calculation?


Vote count:

0




In my code, I use a "switch", of which each case requires String[] processing, for instance:



name:Adam, age:15, gender:m, position:student
name:Lily, age:28, gender:f, position:teacher


If "Adam" is required, the programme will select and return: "15","m". I have implemented this, and I can run it correctly in a "public static void main()". But I would like to implement this in another class file and use a self-defined command, like "getInfo("Adam")", to call this so that the code including "switch" can look tidy.


But how to do this in another file? I know this is relevant to "Public class", but I have no idea on it, particularly I need to run a piece of code in that file.



asked 45 secs ago







How to implement a public class, including some calculation?

Aucun commentaire:

Enregistrer un commentaire