Welcome to the Java Programming Forums


The professional, friendly Java community. 21,500 members and growing!


The Java Programming Forums are a community of Java programmers from all around the World. Our members have a wide range of skills and they all have one thing in common: A passion to learn and code Java. We invite beginner Java programmers right through to Java professionals to post here and share your knowledge. Become a part of the community, help others, expand your knowledge of Java and enjoy talking with like minded people. Registration is quick and best of all free. We look forward to meeting you.


>> REGISTER NOW TO START POSTING


Members have full access to the forums. Advertisements are removed for registered users.

Results 1 to 5 of 5

Thread: java programming

  1. #1
    Junior Member
    Join Date
    Apr 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default java programming

    write a java program which shows all the roles corresponding to a particular actor


  2. #2
    Senior Member PhHein's Avatar
    Join Date
    Mar 2013
    Location
    Germany
    Posts
    609
    My Mood
    Sleepy
    Thanks
    10
    Thanked 93 Times in 86 Posts

    Default Re: java programming

    Do you have a guestion?

  3. #3
    Super Moderator
    Join Date
    Jun 2013
    Location
    So. Maryland, USA
    Posts
    5,517
    My Mood
    Mellow
    Thanks
    215
    Thanked 698 Times in 680 Posts

    Default Re: java programming

    Welcome to the forum! Please read this topic to learn how to post code in code or highlight tags and other useful info for new members.

  4. #4
    Junior Member
    Join Date
    Apr 2014
    Posts
    7
    Thanks
    1
    Thanked 1 Time in 1 Post

    Default Re: java programming

    I went ahead and spent about 5 minutes making this quick example for you. I used an ArrayList.

    For this example, I used Adam Sandler(actor) and gave him two random roles(CIA Agent, and Police Officer) for a movie and made them in a list.

    import java.util.ArrayList;
    public class Test {
    	public static void main(String []args){
    		ArrayList<String> actor = new ArrayList<String>(1);
    		actor.add("Adam Sandler");
    		System.out.println(actor);
     
    		ArrayList<String> roles = new ArrayList<String>(2);
    		roles.add("Police Officer");
    		roles.add("CIA Agent");
    		System.out.println(roles);
    	}
    }

  5. #5
    Junior Member
    Join Date
    Apr 2014
    Posts
    2
    Thanks
    0
    Thanked 0 Times in 0 Posts

    Default Re: java programming

    Thanks Leklur for program, i am almost there in coming up with the exact solution
    Regards
    Collen

Similar Threads

  1. Java Programming (Object Oriented Programming) Assignment
    By azmilPhenom in forum Object Oriented Programming
    Replies: 3
    Last Post: December 21st, 2013, 07:26 AM
  2. Polymorphism Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 2
    Last Post: April 20th, 2013, 02:21 PM
  3. Linked Lists Java Programming HELPP P.S. I am a beginner in Java Programming
    By judemartin99 in forum What's Wrong With My Code?
    Replies: 3
    Last Post: April 20th, 2013, 02:19 PM
  4. android programming vs game programming using java
    By vgoel38 in forum Android Development
    Replies: 4
    Last Post: September 8th, 2012, 05:48 PM
  5. Is java a power full programming language? can java do this?
    By Jhovarie in forum Java Theory & Questions
    Replies: 5
    Last Post: March 2nd, 2011, 02:02 PM