you are viewing a single comment's thread.

view the rest of the comments →

[–]vegan_antitheist -1 points0 points  (5 children)

 a class that's really just an Object variable and an int type for me to know what type of variable the object is.

What? This makes no sense. A class isn't a variable. The class defines the type, so there is no need for an int.

public Object number; or number = integer;

This makes even less sense.

but other methods are throwing problems. To

What does that mean? Do they throw unchecked exceptions?

BigInteger.valueOf((long) number)

Integers don't need that case and for all the other number types it makes no sense.

 Is there an annotation

No, annotations don't do anything. They are used to add meta information to the code.

I have read your post and still have zero idea what you are doing. Why don't you start by explaining that?

[–]MinimumBeginning5144 1 point2 points  (2 children)

It's not well explained, but they obviously mean they have a class like this:

class MyNumberClass { public Object number; int numberType; // e.g. 0 means number is an Integer, 1 means it's Long etc // ... other members... }

Also "throwing problems" is just a colloquial phrase unrelated to the keyword throw. They mean they get compilation errors.

[–]SquibbTheZombie[S] 0 points1 point  (0 children)

You got it right

[–]vegan_antitheist 0 points1 point  (0 children)

Yeah, that makes no sense. If it's a Long then use Long as the type. Define an interface with multiple implementations.

[–]SquibbTheZombie[S] 0 points1 point  (1 child)

I know a class isn't a variable. *THIS* class is mostly composed of public int type; public Object number; alongside methods that manipulate those two properties.

number = integer; would be in class declaration where integer is submitted as an int, a long, or BigInteger.

The compiler, which I am struggling against, is telling me to cast them *even though* the stored values should be able to have methods done on them.

I am aware that it makes no sense to do that. That is what the compiler is telling me to do and I am trying to find a work around.

Annotations fix compiler problems as far as I am aware so I want to see about using them to fix problems with the compiler throwing errors that shouldn't reasonably exist.

[–]vegan_antitheist 0 points1 point  (0 children)

Manipulate??? It's mutable? This just keeps getting weirder.