Logo 
Search:

Java Articles

Submit Article
Home » Articles » Java » Homework HelpRSS Feeds

Program to show an example of Arrays of String

Posted By: Alton Campbell     Category: Java     Views: 2602

A Java Program to show an example of Arrays of String.

Code for Program to show an example of Arrays of String in Java

publicclass JAVA_043
 {

    publicstaticvoid main(String[] args)
    {
       String[] stars={
                         "Robert Redford" , "Marilyn Monroe" ,
                         "Boris Karloff" , "Lassie" ,
                         "Hopalong Cassidy" , "Trigger"
                      };

       int lucky_star=(int)(Math.random( )*stars.length);

       System.out.println("Your lucky star for today is : " + stars[lucky_star]);
    }
 }
  
Share: 


Didn't find what you were looking for? Find more on Program to show an example of Arrays of String Or get search suggestion and latest updates.

Alton Campbell
Alton Campbell author of Program to show an example of Arrays of String is from Philadelphia, United States.
 
View All Articles

 
Please enter your Comment

  • Comment should be atleast 30 Characters.
  • Please put code inside [Code] your code [/Code].

 
No Comment Found, Be the First to post comment!