Skip to Main Content

New to Java

Announcement

For appeals, questions and feedback about Oracle Forums, please email oracle-forums-moderators_us@oracle.com. Technical questions should be asked in the appropriate category. Thank you!

javac from Command Prompt reports errors: <identifier> expected

807599Apr 15 2007 — edited Apr 15 2007
Does anyone know why I get these errors from the Command Prompt?
Print.java:22: <identifier> expected
  printf<String format, Object... args> {
                               ^
Print.java:25: <identifier> expected
} ///:~
^
2 errors
This is the code in its entirety:
//: net/mindview/util/Print.java
// Print methods that can be used without
// qualifiers, using Java SE5 static imports:
package net.mindview.util;
import java.io.*;

public class Print {
  // Print with a newline:
  public static void print(Object obj) {
    System.out.println(obj);
  }
  // Print a newline by itself:
  public static void print() {
    System.out.println();
  }
  // Print with no line break:
  public static void printnb(Object obj) {
    System.out.print(obj);
  }
  // The new Java SE5 printf() (from C):
  public static PrintStream
  printf(String format, Object... args) {
    return System.out.printf(format, args);
  }
} ///:~
Any help is excellent
Comments
Locked Post
New comments cannot be posted to this locked post.
Post Details
Locked on May 13 2007
Added on Apr 15 2007
6 comments
195 views