Win a copy of Rust Web Development this week in the Other Languages forum!

Jello Yao

Greenhorn
+ Follow
since Jan 05, 2003
Cows and Likes
Cows
Total received
0
In last 30 days
0
Total given
0
Likes
Total received
0
Received in last 30 days
0
Total given
0
Given in last 30 days
0
Forums and Threads
Scavenger Hunt
expand Ranch Hand Scavenger Hunt
expand Greenhorn Scavenger Hunt

Recent posts by Jello Yao

class MyClass
{
public static void main(String []args)
{
final int i=100;
byte b = i;
System.out.println(b);
}
}
After run the above code, it compile and print 100. Why it does not need an explicitly cast? i is larger than byte, right? Please help! Thanks
18 years ago
I compiled it. The printout is true. Why Java consider -0.0 equals +0.0?
19 years ago
Does it true or false? Thanks!
Math.min(-0.0,+0.0) == Math.max(0.0,+0.0);
19 years ago
Here is the code about shift? Why the answer for i is -1; j is 0? Thanks!
1: int i = 1;
2: i <<= 31;
3: i >>= 31;
4: i >>= 1;
5:
6: int j = 1;
7: j >>= 31;
8: j >>= 31;
9:
10: System.out.println("i = " +i );
11: System.out.println("j = " +j);
19 years ago
Thanks for the help!
19 years ago
I got the following code on 4test web site. Which print out is right?
**************
Given the following classes defined in separate files:
class Vehicle {
public void drive() {
System.out.println("Vehicle: drive");
}
}
class Car extends Vehicle {
public void drive() {
System.out.println("Car: drive");
}
}
public class Test {
public static void main (String args []) {
Vehicle v;
Car c;
v = new Vehicle();
c = new Car();
v.drive();
c.drive();
v = c;
v.drive();
}
}

Prints out:
Vehicle : drive
Car : drive
Car : drive
or
Prints out:
Vehicle : drive
Car : drive
Vehicle : drive
*******************************
Thanks!
19 years ago
Big thanks! I'm clear about this now.
19 years ago
What is the bit representation for -5? I know how to do it for 5(00000101). But I do not know how to do it for a negative number? Any tips?
Thanks!
19 years ago
Is it legal for a source file which only have try and without any catch blocks?
Thanks!
19 years ago
Does the only difference between using throw and throws is the English grammer?
19 years ago
Can a subclass extend more than one class during declaration? i.e. class Sheep extends Cattle, Animal. Thanks!
19 years ago
Any one please help explain how to represent a negative number by bit? Please give a few examples. Thanks!
19 years ago