Ask Experts Questions for FREE Help !
Ask
    Chelsea4113's Avatar
    Chelsea4113 Posts: 4, Reputation: 1
    New Member
     
    #1

    Nov 7, 2015, 08:26 PM
    Java programming
    I'm having trouble making my random object work properly.
    it prints info, vut the info never changes.
    here's the code:
    Video video1 = new Video(1, "Bear Walking Like a Human");
    //object for "Bear Wlking Like a Human" video
    Video video2 = new Video(2, "Bulldogs vs. Wildcats");
    //object for "Bulldogs vs. Wildcats" video

    Random random = new Random(1000);

    int id = random.nextInt(1)+1;
    int value = random.nextInt(1);

    if (id == 2) {
    if (value == 0) {
    video1.view(true);
    }//liek was pressed for video1
    else {
    video1.view(false);
    }//like was not pressed for video1
    }
    else {
    if (value == 0) {
    video2.view(true);
    }//like was pressed for video2
    else {
    video2.view(false);
    }//like was not pressed for video2
    }//if statement(determined if like was pressed for video1 and video2

    System.out.println(video1);
    System.out.println(video2);

    PLEASE DON'T JUST GIVE ME THE ANSWER. TELL ME WHERE TO LOOK OR CHANGE AND PLEASE EXPLAIN. I want to understand so I won't make the mistake again

Check out some similar questions!

Java programming [ 0 Answers ]

Hello, I am a Computer Science and Engineering student. As a part of my academic curriculum, I need to complete a project. I chose Development in Java platform. My project is regarding automating regression testing in an organization. The user should be able to log into a database by keying in...

Java programming [ 0 Answers ]

How to define a class

Java Programming [ 2 Answers ]

Difference between swings and applets.

Java programming [ 1 Answers ]

Hi, I am running a java program. I want to see the Heap memory used for that program. How to see it?

Java programming [ 1 Answers ]

Read the following statements and explain why it is either true or false 1. The garbage collection mechanism is platform dependent 2.you can suggest when garbage collection will run but you cannot be certain when it will take place. 3.a reference to a primitative variable is eligble for...


View more questions Search
 

Question Tools Search this Question
Search this Question:

Advanced Search

Add your answer here.