Solutions [exclusive] - Java How To Program 9th Edition Exercise

Exercise 5.1: Write a Java application that creates an array of integers and prints its elements.

public class MyName { public static void main(String[] args) { System.out.println("Your Name"); } } java how to program 9th edition exercise solutions

Exercise 4.1: Write a Java method that takes two integers as arguments and returns their sum. Exercise 5

Solution:

Solution:

public class StringLength { public static int stringLength(String s) { return s.length(); } public static void main(String[] args) { String str = "Hello"; int length = stringLength(str); System.out.println(length); } } int length = stringLength(str)

Exercise 3.1: Write a Java application that uses a for loop to print the numbers 1 to 10.