Skip to content

Instantly share code, notes, and snippets.

@codecademydev
Created September 19, 2017 22:54
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save codecademydev/2e406fa349d3cb0d81702cf2cbdbab41 to your computer and use it in GitHub Desktop.
Save codecademydev/2e406fa349d3cb0d81702cf2cbdbab41 to your computer and use it in GitHub Desktop.
Codecademy export
import java.util.ArrayList;
public class Temperatures {
public static void main(String[] args) {
/*create arraylist object weeklyTemperatrues of class type Integer(whole number)
*/
ArrayList<Integer> weeklyTemperatures = new ArrayList<Integer>();
/*adding integers 78, 67, 89, 94 to the arraylist. calling method add on arraylist object weeklyTemperatures
*/
weeklyTemperatures.add(78);
weeklyTemperatures.add(67);
weeklyTemperatures.add(89);
weeklyTemperatures.add(94);
//using get method to print lowest temp in weeklyTemperatrues
System.out.println(weeklyTemperatures.get(1));
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment