Advertisement
fosterbl

ArrayNotes2.java

Feb 21st, 2020
206
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Java 0.67 KB | None | 0 0
  1. public class ArraysNotes2{
  2.    public static void main(String[] args){
  3.       //lets make an array of movie titles
  4.       String[] movieTitles = {"Jaws", "Spaceballs", "Pulp Fiction", "Monty Python and the Holy Grail", "The Notebook"};
  5.       //lets make an array of those movies' ratings
  6.       int[] movieRatings = new int[5];
  7.       movieRatings[0] = 98;
  8.       movieRatings[1] = 59;
  9.       movieRatings[2] = 92;
  10.       movieRatings[3] = 97;
  11.       movieRatings[4] = 53;
  12.  
  13.       //Print out each movie's title and rating
  14.       System.out.println( movieTitles[0]  + " received a " + movieRatings[0] );
  15.       System.out.println( movieTitles[1]  + " received a " + movieRatings[1] );
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement