Results 1 to 10 of 10

Thread: basic java

  1. #1
    sukeerthi is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Post basic java

    how we check value of the variable is string or numeric?

  2. #2
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,941
    Rep Power
    8

    Default Re: basic java

    What have you tried? You should know the type of a variable, since you have to specify that. Do you mean something else?
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  3. #3
    jfabian is offline Member
    Join Date
    Jun 2012
    Posts
    22
    Rep Power
    0

  4. #4
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: basic java

    Please go through the Forum Rules -- particularly the third paragraph.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

  5. #5
    Ksharp is offline Banned
    Join Date
    Jun 2012
    Location
    Beijing,China
    Posts
    34
    Rep Power
    0

    Default Re: basic java

    How about:
    Java Code:
     
    public class x{
     
        public static void main(String [] args)  {
    
        String x="3245  ";
    
        if (x.equals(x.replaceAll("\\D"," ")) ) System.out.println(x +" is Numeric");
          else System.out.println(x+"is Character");
        
         
      }
    
     
    }



    Ksharp
    Last edited by Ksharp; 06-29-2012 at 08:06 AM.

  6. #6
    KevinWorkman's Avatar
    KevinWorkman is online now Crazy Cat Lady
    Join Date
    Oct 2010
    Location
    Washington, DC
    Posts
    3,941
    Rep Power
    8

    Default Re: basic java

    Spoonfeeding is NOT helping. Spoonfeeding crappy code is actually harmful. I appreciate that you're trying to help, but that's NOT helping.

    This is probably for a programming homework assignment where the point of the assignment was to do some research, try some things out, work on problem solving. Problem solving is incredibly important to programming, and it's really hard to teach (and learn) other than by working through assignments. You just took away the "a-ha!" moment that's so important to that process. Even if the OP uses your code, what happens during a test? Or during the next assignment that builds on the lessons learned here?

    Just something to keep in mind when you help in the future...
    How to Ask Questions the Smart Way
    Static Void Games - Play indie games, learn from game tutorials and source code, upload your own games!

  7. #7
    sukeerthi is offline Member
    Join Date
    Jun 2012
    Posts
    3
    Rep Power
    0

    Default Re: basic java

    thanq

  8. #8
    Ksharp is offline Banned
    Join Date
    Jun 2012
    Location
    Beijing,China
    Posts
    34
    Rep Power
    0

    Default Re: basic java

    What's matter with you ? Even My code is crap , That is also not your bussiness.
    If you think it is laughable ,go away . I don't need any words from you.

  9. #9
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,967
    Rep Power
    19

    Default Re: basic java

    The forum has a rule that we don't spoon feed answers, as that's not considered constructive since they most often occur for people who are trying to learn the language or complete some academic problem. It's the old case of teaching someone to fish rather than giving them a fish.

    Your code would work if you didn't replace the spaces, at least for integers.
    I don't consider a String containing spaces as a valid integer.
    Please do not ask for code as refusal often offends.

    ** This space for rent **

  10. #10
    DarrylBurke's Avatar
    DarrylBurke is online now Member
    Join Date
    Sep 2008
    Location
    Madgaon, Goa, India
    Posts
    11,202
    Rep Power
    19

    Default Re: basic java

    Quote Originally Posted by Ksharp View Post
    What's matter with you ? Even My code is crap , That is also not your bussiness.
    If you think it is laughable ,go away . I don't need any words from you.
    So, you think you know better than Kevin? You can see he has than 2,000 posts on this forum; he also has several thousand more on other forums, but you're not expected to know that, and is a community moderator on at least 2 Java forums, but you're not expected to know that either.

    I repeat what Kevin has said: Spoonfeeding is NOT helping. Spoonfeeding crappy code is actually harmful.

    I'll also add that members who have refused to accept moderator advice in this regard and who have obstinately continued to spoonfeed crappy code have been banned. If you don't take this seriously, you're headed the same way.

    db
    If you're forever cleaning cobwebs, it's time to get rid of the spiders.

Similar Threads

  1. [ASK] Need help about java basic T_T
    By shezars in forum New To Java
    Replies: 5
    Last Post: 03-09-2012, 04:22 AM
  2. Java Basic
    By Anveshan in forum New To Java
    Replies: 6
    Last Post: 05-06-2011, 09:45 AM
  3. Basic java
    By santa in forum New To Java
    Replies: 5
    Last Post: 11-16-2009, 10:16 AM
  4. basic java
    By vijay24805 in forum New To Java
    Replies: 25
    Last Post: 04-14-2009, 02:46 AM
  5. basic java help
    By adred in forum New To Java
    Replies: 0
    Last Post: 03-08-2008, 12:36 PM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •