🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

Article View: borland.public.jbuilder.java.language
Article #16229

Parameter Passing

#16229
From: Shahid Juma
Date: Sat, 20 Mar 1999 00:00
26 lines
1352 bytes
Hello

I have a method which compares if an object is an instance of an
Integer.  However, I want to make that method so that I can check if it
is an Integer or a String.  What I mean is that when I call my method
nodeType, I pass in (node, node, String or Integer) and accordingly it
will check if it is an instance or not.  However, if I just send in
(node, node, Integer), it says that Integer is invalid.  Is there any
way without creating another method to check if it is a string and an
Integer.

Thanks
Shahid

My method:

public boolean nodeType (Node a, Node b) {
     boolean left = a.value() instanceof Integer;
     System.out.println ("left: " + left);
     boolean right = b.value() instanceof Integer;
     System.out.println ("right: " + right);
     if (left && right)
         return true;
     else
         return false;
}
Technical Details
Message-ID: <36F439EE.BA178439@interlog.com>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,8d38e1e6e8d4e65d,start
X-Google-Attributes: gidf74b3,public
From: Shahid Juma <shahidj@interlog.com>
Subject: Parameter Passing
Date: 1999/03/20
Message-ID: <36F439EE.BA178439@interlog.com>
X-Deja-AN: 457006090
Content-Transfer-Encoding: 7bit
Organization: Another Netscape Collabra Server User
Content-Type: text/plain; charset=us-ascii
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language