b

b

Monday, February 15, 2016

Ex 5.3, Ex. 5.4, and Ex. 5.5

Solution for Ex. 5.3, 5.4, and 5.5....


==============================================================

// Exercise Solution 5.3
public class Exe5_3
{
private static final Object MIN_LENGTH = null;

public static void main(String[] args) {
Object length = null;
if (length == MIN_LENGTH)
System.out.println("The length is minimal.");
}
}

==============================================================

// Exercise solution 5.4
public class Exe5_4 {

public static void main(String[] args) {

int num = 87, max = 25;
if (num >= max*2)
System.out.println ("apple");
System.out.println ("orange");
System.out.println ("pear");
}
}

==============================================================

public class Exe5_5 {

public static void main(String[] args) {
int limit = 100, num1 = 15, num2 = 40;
if (limit <= limit)
{
if (num1 == num2)
System.out.println("lemon");
System.out.println("lime");}
System.out.println("grape");
}
}

=============================================================

No comments:

Post a Comment