Article View: borland.public.jbuilder.java.language
Article #8394Re: Simple question for gurus ;)
From: Stefan Adolfsson
Date: Wed, 21 Mar 2001 11:05
Date: Wed, 21 Mar 2001 11:05
63 lines
3047 bytes
3047 bytes
I dont claim to be a guru, but I think the recommended is to use a
return statement. But in case of changing 2 variables with one method,
I dont know what is prefered..
On Tue, 20 Mar 2001 19:20:47 +0100, "John Good"
<dumster@collector.org> wrote:
>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:
<3ab88a89.1917644@news.cs.umu.se>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!news.tele.dk!195.54.122.107!newsfeed1.bredband.com!bredband!newsfeed1.telenordia.se!algonet!newsfeed.sunet.se!news01.sunet.se!news.umu.se!not-for-mailReferences:
<3ab77ebc.28129735@news.cs.umu.se> <3ab780b0.28630005@news.cs.umu.se> <lcNt6.20$mR5.1220@psinet-eu-nl>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-21 03:32:07 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!news-out.usenetserver.com!news-out-sjo.usenetserver.com!news.tele.dk!195.54.122.107!newsfeed1.bredband.com!bredband!newsfeed1.telenordia.se!algonet!newsfeed.sunet.se!news01.sunet.se!news.umu.se!not-for-mail From: stefan.adolfsson@usa.net (Stefan Adolfsson) Newsgroups: borland.public.jbuilder.java.language Subject: Re: Simple question for gurus ;) Date: Wed, 21 Mar 2001 11:05:34 GMT Organization: News UmU SE Lines: 64 Message-ID: <3ab88a89.1917644@news.cs.umu.se> References: <3ab77ebc.28129735@news.cs.umu.se> <3ab780b0.28630005@news.cs.umu.se> <lcNt6.20$mR5.1220@psinet-eu-nl> NNTP-Posting-Host: flintv158.sn.umu.se X-Trace: hudsucker.umdac.umu.se 985173053 16399 130.239.145.212 (21 Mar 2001 11:10:53 GMT) X-Complaints-To: newsmaster@umu.se NNTP-Posting-Date: Wed, 21 Mar 2001 11:10:53 +0000 (UTC) X-Newsreader: Forte Free Agent 1.21/32.243