Simple Java

Posted on 2009-02-11
Last Modified: 2013-11-23
Dear all,

I am new to Java language and just trying to get to grips with it.

I have been given this question:

Write a class in which use instance variables name and myval and make objects of this  class and assign the value of myval  variable using Math.random() method and print the name of  objects who gets the maximum and minimum values .

The problem is it asking to print the name of objects wh gets the maximum and minimum values?

What are they asking from that?


Lyon JT
Question by:LyonJay
    LVL 2

    Expert Comment

    Can you please explain a bit better? and also post the code you have at the moment
    LVL 3

    Author Comment

    I need to answer that question above basically.

    I have no code at the moment i wanted to understand the question before i code it.


    Lyon JT
    LVL 2

    Accepted Solution

    sounds to me like they want you to make a class with 2 instance variables, one which is a name for the object and the other a random value.

    then you need to print out the object that has the biggest value "myVal" and the object with the lowest.
    the easiest would be to create your objects in a loop, and with another loop get maximum and minimum

    Write Comment

    Please enter a first name

    Please enter a last name

    We will never share this with anyone.

    Featured Post

    How to run any project with ease

    Manage projects of all sizes how you want. Great for personal to-do lists, project milestones, team priorities and launch plans.
    - Combine task lists, docs, spreadsheets, and chat in one
    - View and edit from mobile/offline
    - Cut down on emails

    Suggested Solutions

    Title # Comments Views Activity
    Exchange and Third Party application. 8 45
    Multiple issues with Java 14 37
    scoresClump  challenge 31 83
    Modeling a class in java 5 21
    For customizing the look of your lightweight component and making it look opaque like it was made of plastic.  This tip assumes your component to be of rectangular shape and completely opaque.   (CODE)
    Introduction This article is the first of three articles that explain why and how the Experts Exchange QA Team does test automation for our web site. This article explains our test automation goals. Then rationale is given for the tools we use to a…
    Viewers will learn about the different types of variables in Java and how to declare them. Decide the type of variable desired: Put the keyword corresponding to the type of variable in front of the variable name: Use the equal sign to assign a v…
    This tutorial covers a step-by-step guide to install VisualVM launcher in eclipse.

    794 members asked questions and received personalized solutions in the past 7 days.

    Join the community of 500,000 technology professionals and ask your questions.

    Join & Ask a Question

    Need Help in Real-Time?

    Connect with top rated Experts

    16 Experts available now in Live!

    Get 1:1 Help Now