• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

What do you do when you encounter a test question...

AFB

Lifer
where the teacher has said something breifly in the past that was wrong about it.

For example, on a CS (Java) test I had two questions.

Q: Which of the following can you not store a numerical value in?

a) int
b) double
c) char
d) None of the above work
e) All of the above work

Well, the correct answer is (e) b/c you can cast a number to a char and get it back. We've never done this before so I have no basis for comparison.


Q: [t/f] You have to import the package to use classes outside of java.lang

FALSE: new java.util.Random();

No one else put this, I do remember her stating the opposite a few times before.





 
Originally posted by: Colt45
1 is E, as far as I can see


Don't trust me though, I get errors compiling hello world.

Yeah, it is

char c = (char) 5;
c++;
int myNum = (int) c;
System.out.println(myNum);
 
put down the correct the answer and write something to justify it? that's' what i'd do if i'm positive i'm right

unless it's one of those scanned forms of course...
 
I don't think there's any other way of storing a 8-bit integer other than storing it in a char. That is why I would put E for 1.
 
Originally posted by: Vertimus
I don't think there's any other way of storing a 8-bit integer other than storing it in a char. That is why I would put E for 1.

Java has a byte type and two byte chars.
 
1 is C. char data types do not store numbers, they store characters. Just because you can convert between data types does not mean that a char can store numbers. Just because I can convert water to steam does not mean I can store steam in a coffee cup.

And java characters are not 8-bit, they're unicode.
 
Back
Top