Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

basic java question

Status
Not open for further replies.

786snow

Programmer
Nov 12, 2006
75
0
0
I am trying to learn javaservlet. I got this code from an example. I don't understand what is "List" here? Why have the put List when they decalared the method "getBrands()"?

and also when they decalared the array brands? is it a some variable type?


**************


import java.util.*;

public class BeerExpert {

public List getBrands (String Color) {

List brands = new ArrayList();
if (color.equals("ambder"))
{ brands.add("Jack Amber");
brands.add("Red Moose")

}

else

{

brands.add("Jail Pale Ale");
brands.add("Gout Stout");
}

return (brands);
}




}

************************













}
 
I think you need to learn basic Java syntax first.

Code:
public List getBrands (String Color){
 ..
}

indicates a method which takes an object of type String and returns an object of type List. You can't realistically tackle Java Servlets without knowing Java basics.

Tim
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top