Carey Brown

Saloon Keeper
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
Forum Moderator
Cows and Likes
Cows
Total received
54
In last 30 days
2
Total given
2
Likes
Total received
902
Received in last 30 days
61
Total given
119
Given in last 30 days
6
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

What format do you want the line in? How are you going to deal with multiple contacts if you have only one text field for each contact field?
7 hours ago
It's not clear what your requirements are. Do you want first, last, and phone on separate lines or all on one line separated by a space? Do you want multiple "persons" or just one?

It is also helpful to make a simple self contained compilable example to play with. Here is one with a variety of approaches...
Note that when you use write() you'll need to supply your own new-line.
9 hours ago

Ruben Ochoa wrote:Indeed. The output is [ ],[ ].[ ] 3 times, filled by names. What loop i must use? While(true)? I tried

You need to be clearer when responding. Do you get "[]" or do you get "somename"?

You are filling your array with three pieces of data. When you are printing the data you will get a single line of three pieces of data separated with commas. If you want multiple name entries you'll have to fill your list outside of this write method. You don't need any loop to write the three pieces of data. You will need a loop if you fill in the list outside of your method.
10 hours ago
My "ah ha!" moment in learning enums is to realize that there is a lot of over lap between classes an enums. So enums can have multiple member variables and when you declare an enum (e.g. MICHIGAN) it can have multiple parameters. You then need a constructor that will take those parameters.
10 hours ago
Look like you'd get three identical lines in the file. You have a loop counter but you don't use 'k' anywhere.

What behavior are you seeing?
11 hours ago
A couple of things that would help us help you:
  • Cut and past the entire error message into your post.
  • Wrap long lines of code to make them shorter (I get your long lines chopped off on my laptop).
  • When possible, provide a main() method so that it can be run.
  • Stub out classes that wouldn't normally be included so that it can be run (e.g. YearData).
  • Your code has too many unnecessary uses of "this.". It is only necessary to disambiguate between local and member variables of the same name.
  • Take your line 123 and break it into multiple lines and perhaps the error message will show you more specifically which variable it's crashing on.
  • Where you declare your member variables you can initialize them there so that they are never null, so, if they still end up null then it's due to a call to one of the constructors.
  • Perhaps add a validate method to do some basic validation of your class data.
  • 11 hours ago

    nanouha abab wrote:Actually, I need to find only the second index of the minimum value of each array of 2 arrays. I try to code with one array and it works. What I must do to find the index of min of each row of  int[] []a ={ {5, 4, 0, 2, 10, 30, 3},{5, 4, 0, 2, 10, 30, 3}};

    You are not properly updating 'secondSmallesIndex'.
    1 day ago
    I would have preferred to see variable 'i' named 'student' or 'studentIndex'. Something that tells you its role.
    1 day ago
    Looks like grades[count - 1] will give you an out of bounds exception because 'count' is zero.
    1 day ago

    Vaibhav Gargs wrote:Does it really mean that the companies like Expedia pay millions of dollars to consume their webservices? But, won't it increase the airlines sales so shouldn't they expose these APIs free of cost?

    And, what is the best architecture being implemented in this domain - should it be synchronous webservices or async JMS based?


    Sure, it may increase "airline" sales, but not Expedia sales which is how they get paid. The back-end is all main frame computers and there is no web based API, that is supplied by Expedia, et al..
    1 day ago
    Without knowing about the design of Food and of getDetails(), which seems to return a Collection of some sort, it seems a bit premature to think there are "Bananas".
    2 days ago
    You gave Random a seed of '100', this sets the starting point for random values. If you use the same seed again then random numbers will be generated in exactly the same order.
    2 days ago
    @Darko, to apply Code tags you need to first highlight your code with the mouse and then click the "Code" button. You can verify that this worked properly by clicking the "Preview" button at the bottom.
    3 days ago
    Java only support some image file formats. So, how do you tell which one has been requested? There are two ways: by the file name suffix, or by the key contained in (I think) the first 8 bytes of data. As an example, I believe the first four bytes of a JPG file are the ASCII values for "JFIF". Each file type has a unique key. A little research should tell you what they are. You could write a method that reads the first 8 bytes and returns an enum of the file type and then use Java methods to read that file type into a BufferedImage.
    3 days ago
    4 days ago