wood burning stoves 2.0*
The moose likes Beginning Java and the fly likes distinct Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Java » Beginning Java
Bookmark "distinct" Watch "distinct" New topic
Author

distinct

Tom Cummings
Greenhorn

Joined: Nov 08, 2012
Posts: 7
My teacher has this method to make a boolean array and get distinct values from an array. I have tried to run it but it only prints the array not the unique values from it.
Ivan Franko
Ranch Hand

Joined: May 30, 2011
Posts: 44
Sorry, could you please provide Actual and Expected results?
Campbell Ritchie
Sheriff

Joined: Oct 13, 2005
Posts: 39884
    
  28
What is that method supposed to do?
Jesper de Jong
Java Cowboy
Saloon Keeper

Joined: Aug 16, 2005
Posts: 14352
    
  22

You say the method "only prints the array", but the code you posted does not print anything at all.

Note that lines 5 and 6 are unnecessary - when you create a new array of booleans (line 4), they're already all initialized to false. You don't have to do that explicitly.


Java Beginners FAQ - JavaRanch SCJP FAQ - The Java Tutorial - Java SE 8 API documentation
Tom Cummings
Greenhorn

Joined: Nov 08, 2012
Posts: 7
It is suppose to take an array (int [] list = {50, 40, 70, 85, 40, 20, 40, 55, 95,57};) Then print the method
from another class with non duplicates.


The above is the other class
Steve Luke
Bartender

Joined: Jan 28, 2003
Posts: 4181
    
  21

Jesper de Jong wrote:You say the method "only prints the array", but the code you posted does not print anything at all.


This problem still stands. It seems like you want the method to print something. If you do you should add some code which does some printing.


Steve
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: distinct