Article View: borland.public.jbuilder.java.language
Article #8395Re: Simple question for gurus ;)
From: John Good
Date: Wed, 21 Mar 2001 13:07
Date: Wed, 21 Mar 2001 13:07
80 lines
3831 bytes
3831 bytes
Yes, I agree on the return method, but it's quite unreasonable to left-out
basic types without any built-in library for encapsulation (ie
java.lang.whatever), it's like if you've been left to develop your own
routines for addition, substraction, multiplication, etc. Who cares? When
I'm developing a project I don't want to waste my time on developing some
things that I assume normal-to-have... It's something that should be
provided by some library... I think :)
"Stefan Adolfsson" <stefan.adolfsson@usa.net> wrote in message
news:3ab88a89.1917644@news.cs.umu.se...
> 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:
<wI1u6.11$EC.883@psinet-eu-nl>Path:
arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!news-x2.support.nl!psinet-eu-nl!not-for-mailReferences:
<3ab77ebc.28129735@news.cs.umu.se> <3ab780b0.28630005@news.cs.umu.se> <lcNt6.20$mR5.1220@psinet-eu-nl> <3ab88a89.1917644@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-21 05:12:08 PST Path: arc1-ca.pugleaf.net!supernews.google.com!sn-xit-03!supernews.com!hermes.visi.com!news-out.visi.com!news.maxwell.syr.edu!fr.clara.net!heighliner.fr.clara.net!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> <lcNt6.20$mR5.1220@psinet-eu-nl> <3ab88a89.1917644@news.cs.umu.se> Subject: Re: Simple question for gurus ;) Lines: 82 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: <wI1u6.11$EC.883@psinet-eu-nl> Date: Wed, 21 Mar 2001 14:07:20 +0100 NNTP-Posting-Host: 195.114.201.103 X-Complaints-To: abuse@uk.psi.com X-Trace: psinet-eu-nl 985180060 195.114.201.103 (Wed, 21 Mar 2001 13:07:40 GMT) NNTP-Posting-Date: Wed, 21 Mar 2001 13:07:40 GMT Organization: Connectivity but not content by PSINet