Win a copy of Machine Learning Systems: Designs that scale this week in the Scala forum
or Xamarin in Action: Creating native cross-platform mobile apps in the Android forum!

Carey Brown

Bartender
+ Follow
since Nov 19, 2001
Carey likes ...
Eclipse IDE Firefox Browser Java MySQL Database VI Editor Windows
Cows and Likes
Cows
Total received
48
In last 30 days
0
Total given
1
Likes
Total received
733
Received in last 30 days
26
Total given
101
Given in last 30 days
7
Forums and Threads
Scavenger Hunt
expand Rancher Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Carey Brown

Carey Brown wrote:I did run into a problem when parsing your dates with more than 3 digits in the milliseconds. I even tried a format with "...    .SSSSSS" and it didn't work.

23 hours ago
"HOUR_OF_DAY".
1 day ago
I did run into a problem when parsing your dates with more than 3 digits in the milliseconds. I even tried a format with "...    .SSSSSS" and it didn't work.
1 day ago

  • Variable names must begin with a lower case character.

  • 1 day ago
    FYI
    1 day ago
    If you don't what to print nulls then you need to add an 'if'.

    Get in the habit of always posting the code you've changed.
    2 days ago

    omar tawfeek wrote:i don't know what to write inside the method for printing.

    You don't "print" or "display" anything inside the method. You create a string that is the composite of your subjects and return that string.
    but turn that into a loop and have the method return 's'.
    To concatenate strings you can do this
    2 days ago

    omar tawfeek wrote:i am trying to teach myself arrays because it is hard for me to do stuff with array in MessageDialog .


    Yes. That is why I'm telling you that you need to create a method to convert an array of Strings into a single formatted String. If you want to check for null, if you want to add "Subject", if you want to add new-lines, you'll need the logic for all of that inside the method.
    Once you've done that you can call that method as a parameter to your call to JOptionPane.showMessageDialog().
    2 days ago

  • Variable names must begin with a lower case character.
  • You do not have a StringBuilder object you have an array of Strings.
  • It should be named in a way that you don't have to wonder what kind of data it holds. "subjects" in your original post was correct (except it should be plural).
  • 2 days ago
    The loop needs to be in the subjectToString() method. If you don't like my name for this method make up one of your own, but DO NOT call it getSubject(). The 'get' prefix is reserved for 'getters', and this is not a getter.


    Maybe we should back up a bit. Can you describe in English what you are trying to do?
    2 days ago

    omar tawfeek wrote:is it possible to make it with for loop :

    String 1 = string
    String 2 = string
    String 3 = string
    String 4 = string
    String 5 = string

    i am trying to make it with for loop but it doesn't work for me


    1) you will need a loop ----- read the pseudo code I gave you.
    2) "it doesn't work" tells me nothing ---- you have to post the code and any error messages.
    3) it won't have a new-line unless you put it there.
    2 days ago
    What did you do with the String[] in your class? Why?
    2 days ago

    Carey Brown wrote:Write your own method that takes a String[] as an argument and returns a formatted String. Use StringBuilder to append the strings together.


    You aren't reading my suggestion correctly
    2 days ago

    omar tawfeek wrote:i am trying to do it like that but it always gives me an error in compile .

    Post what you wrote and copy and paste error message into the post.
    2 days ago
    In Java, array indexes start with zero. Your loop needs to be
    2 days ago