🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Parameter Passing

#16233
From: Leo Cohen
Date: Sun, 21 Mar 1999 00:00
37 lines
1726 bytes
Try passing (node, node, Object) and test Object.isInstanceOf.

If this works you should probably make the call look like
    (node, node, (Object)<String|Integer>)

That is, cast the string or integer to object type.

Leo.

Shahid Juma wrote:

> 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: <36F4FE40.2A8E79A3@cs.virginia.edu>
Path: arc1-ca.pugleaf.net!unknown!not-for-mail
References: <36F439EE.BA178439@interlog.com>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,8d38e1e6e8d4e65d
X-Google-Attributes: gidf74b3,public
From: Leo Cohen <lcohen@cs.virginia.edu>
Subject: Re: Parameter Passing
Date: 1999/03/21
Message-ID: <36F4FE40.2A8E79A3@cs.virginia.edu>
X-Deja-AN: 457208161
Content-Transfer-Encoding: 7bit
References: <36F439EE.BA178439@interlog.com>
X-Accept-Language: en
Content-Type: text/plain; charset=us-ascii
Organization: Another Netscape Collabra Server User
Mime-Version: 1.0
Newsgroups: borland.public.jbuilder.java.language