Results 1 to 3 of 3
  1. #1
    cakeman is offline Member
    Join Date
    Mar 2008
    Posts
    4
    Rep Power
    0

    Default Help with a very simple method for a very simple beginner.

    Hi Everybody

    How would I write a method / line of code to test wether or not an instance variable referenced a String? I'm trying to write a method that returns true if the variable references a String but I'm getting nowhere fast.

    Many Thanks

    Cakeman

  2. #2
    sukatoa's Avatar
    sukatoa is offline Senior Member
    Join Date
    Jan 2008
    Location
    Cebu City, Philippines
    Posts
    556
    Rep Power
    10

    Default

    How did you assigned that instance variable? Is it an Object variable?
    i am little bit doubt, can you show more info?
    freedom exists in the world of ideas

  3. #3
    cakeman is offline Member
    Join Date
    Mar 2008
    Posts
    4
    Rep Power
    0

    Default

    Hi

    The instance variables will be set with a mutator method and not in the constructor so when new instances are first created, the instance variable is null. Just as I'm writing this I think I've sussed it. The method I need to write needs to return true if the instance variable references a string, false otherwise so, if the variable is null, it returns false. I'll try that first and post my results

Similar Threads

  1. A Simple Web Server
    By Java Tip in forum java.net
    Replies: 0
    Last Post: 04-07-2008, 08:04 PM
  2. Simple Method Question
    By Froz3n777 in forum New To Java
    Replies: 2
    Last Post: 02-13-2008, 03:39 AM
  3. Simple java
    By abhiN in forum New To Java
    Replies: 1
    Last Post: 01-16-2008, 11:13 AM
  4. simple GUI
    By dim_ath in forum New To Java
    Replies: 3
    Last Post: 01-07-2008, 04:00 PM
  5. simple code
    By elizabeth in forum New To Java
    Replies: 1
    Last Post: 08-07-2007, 06:49 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
  •