TEAM-ADA Archives

Team Ada: Ada Programming Language Advocacy


Options: Use Classic View

Use Proportional Font
Show Text Part by Default
Show All Mail Headers

Topic: [<< First] [< Prev] [Next >] [Last >>]

Print Reply
Geoff Bull <[log in to unmask]>
Wed, 12 Apr 2000 11:54:43 +1000
text/plain (34 lines)
[log in to unmask] wrote:

> Another problem is Java's lack of information hiding (though you *can* get the
> same problem in Ada, it's more difficult)
> viz in the code fragment,
>    a = 1;
>    b = a;
>    a = a+1;
> what does b equal?


> In Java:
> if b is the primitive "int", then b=a-1
> if b is the class "Integer" then b = a means in Ada terms b renames a. For which
> we can thank C.

But b must have been a primitive, because operators only work for primitives
(except for "+" for catenating Strings).

Have I missed something?

> If b is a primitive, you can't do text output of it.

int b = 5;
System.out.println ("" + b);
// this prints a line with a 5 on it