Click here to Skip to main content
15,793,452 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
Build a presidents() method that prints out the names of the first 7 Presidents of the United States, each on separate lines. Remember to make your method a static method. Have your main method call the presidents() method. Call your class “PresClass”

What I have tried:

Like I'm getting confuse of how to make my code for this question. Like do I have to put a return statement to make it work
Here my code:
public class PresClass { 
public static String {
public static void presidents(String args[]) {
System.out.print("George Washington");
System.out.print("John Adams");
System.out.print("Thomas Jefferson");
System.out.print("James Madison");
System.out.print("James Monroe");
System.out.print("John Quincy Adams");
System.out.print("Andrew Jackson");
Updated 19-Feb-18 12:28pm
phil.o 19-Feb-18 17:17pm    
The code you showed is not well-formed. Two of the three opening braces are not closed. Please correct it.

1 solution

The requirements are clear, you have to fill the following skeleton
class PresClass
  static void presidents()
    // your code here
  public static void main( String args[] )
Share this answer

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900