Results 1 to 3 of 3
Thread: swirling becomes false,why?
- 01-18-2010, 05:49 PM #1
Member
- Join Date
- Dec 2009
- Posts
- 76
- Rep Power
- 0
swirling becomes false,why?
Java Code:class Liquid { private int mlVolume; private float temperature; // in Celsius public Liquid() { mlVolume = 300; temperature = (float) (Math.random() * 100.0); } public float getTemperature() { return temperature; } // Has several other methods, not shown... } class Coffee extends Liquid { private static final float BOILING_POINT = 50.0f; // Celsius private boolean swirling; private boolean clockwise; public Coffee(boolean swirling, boolean clockwise) { if (getTemperature() >= BOILING_POINT) { // Leave swirling at default value: false [b]return;[/b] } this.swirling = swirling; if (swirling) { this.clockwise = clockwise; } // else, leave clockwise at default value: false } void show() { System.out.println("BOILING_POINT "+BOILING_POINT); System.out.println("temperature "+getTemperature()); System.out.println("swirling "+swirling); System.out.println("clockwise "+clockwise); } // Has several methods, not shown, // but doesn't override getTemperature()... public static void main(String args[]) { Coffee ob=new Coffee(true,false); ob.show(); } }
in above code, what does return do?
when getTemperature() >= BOILING_POINT, swirling becomes false, why?
- 01-18-2010, 05:56 PM #2
Senior Member
- Join Date
- Jun 2008
- Posts
- 339
- Rep Power
- 12
- 01-18-2010, 07:12 PM #3
Member
- Join Date
- Dec 2009
- Posts
- 76
- Rep Power
- 0
Similar Threads
-
If statement executing when false...
By ribbs2521 in forum New To JavaReplies: 6Last Post: 10-26-2009, 06:19 PM -
ResultSet next() returns false Yet Tuples Present
By mjz in forum JDBCReplies: 4Last Post: 08-11-2009, 12:31 PM -
hibernate lazy=False
By Ed in forum JDBCReplies: 2Last Post: 07-02-2007, 08:54 PM -
How can i set the table's column dragable/movable false and cell editable
By johnt in forum AWT / SwingReplies: 4Last Post: 05-19-2007, 12:15 PM
Bookmarks