🚀 go-pugleaf

RetroBBS NetNews Server

Inspired by RockSolid Light RIP Retro Guy

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

Re: Simple question for gurus ;)

#8390
From: John Good
Date: Tue, 20 Mar 2001 18:20
54 lines
2722 bytes
Yes, that idea with creating a class integer crossed my mind. But there is
still the question, what is the "philosophy" of Java; what is recommended
way of doing this? Creating an object? Using arrays/vectors/etc?

I'm not sure that creating objects is an ideal solution, maybe in theory,
but in practice, it's little bit like C and strings. You have some support
for it, but it's so bad, that you usually have to write your own routines
for handling strings. I cannot beleive that the same thing is happening with
Java (only, they learned about Strings, but the ints are the bone ;)

Is there anyone "official" on the group or someone that considers himself a
Java-all-time-guru that can explain the situation. Am I supposed to write
wrapper classes for all the basic types?!

Regards and TIA


"Stefan Adolfsson" <stefan.adolfsson@usa.net> wrote in message
news:3ab780b0.28630005@news.cs.umu.se...
> Found a slightly nicer solution... Creating your own version of an
> int.. This is what i did really when i thought i was using the Integer
> class... My memory is too short.
>
> This is my own version of an int class, treated as an object...
>
> class myInt {
> int val;
> myInt(int tmpValue){
> val=tmpValue;
> }
> void set(int tmp) {
> val=tmp;
> }
> int val() {
> return val;
> }
> }
>
> //Copy this too if u want a working example:
>
> class Hej {
> Hej() {
> myInt a = new myInt(0);
> System.out.println(a.val());
> change(a);
> System.out.println(a.val());
> }
> public void change(myInt b) {
> b.set(7);
> }
> public static void main(String args[]) {
> Hej newProg = new Hej();
> }
> }
Technical Details
Message-ID: <lcNt6.20$mR5.1220@psinet-eu-nl>
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!newspeer.clara.net!news.clara.net!skynet.be!news-x2.support.nl!psinet-eu-nl!not-for-mail
References: <3ab77ebc.28129735@news.cs.umu.se> <3ab780b0.28630005@news.cs.umu.se>

Show Full Headers
Complete Article Headers
X-Google-Language: ENGLISH,ASCII-7-bit
X-Google-Thread: f74b3,a90669a07786d662
X-Google-Attributes: gidf74b3,public
X-Google-ArrivalTime: 2001-03-20 10:24:06 PST
Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-02!supernews.com!news.tele.dk!212.74.64.35!colt.net!newspeer.clara.net!news.clara.net!skynet.be!news-x2.support.nl!psinet-eu-nl!not-for-mail
From: "John Good" <dumster@collector.org>
Newsgroups: borland.public.jbuilder.java.language
References: <3ab77ebc.28129735@news.cs.umu.se> <3ab780b0.28630005@news.cs.umu.se>
Subject: Re: Simple question for gurus ;)
Lines: 56
X-Priority: 3
X-MSMail-Priority: Normal
X-Newsreader: Microsoft Outlook Express 5.50.4133.2400
X-MimeOLE: Produced By Microsoft MimeOLE V5.50.4133.2400
Message-ID: <lcNt6.20$mR5.1220@psinet-eu-nl>
Date: Tue, 20 Mar 2001 19:20:47 +0100
NNTP-Posting-Host: 195.114.201.103
X-Complaints-To: abuse@uk.psi.com
X-Trace: psinet-eu-nl 985112465 195.114.201.103 (Tue, 20 Mar 2001 18:21:05 GMT)
NNTP-Posting-Date: Tue, 20 Mar 2001 18:21:05 GMT
Organization: Connectivity but not content by PSINet