Thread: formatting..
View Single Post
  #1 (permalink)  
Old 12-11-2007, 12:27 AM
sireesha sireesha is offline
Member
 
Join Date: Nov 2007
Posts: 50
sireesha is on a distinguished road
formatting..
i saw this code in a book.
Code:
import java.util.*; public class test4 { public static void main(String args[]) { Calendar c=Calendar.getInstance(); System.out.format("%tB %td,%tY%n",c,c,c); System.out.format("%tl:%tM %tp%n",c,c,c); System.out.format("%tD%n",c); } }
but when i compile this i got some errors.
like..
Code:
test4.java:12: cannot resolve symbol symbol : method format (java.lang.String,java.util.Calendar,java.util.Calendar, java.util.Calendar) location: class java.io.PrintStream System.out.format("%tB %td,%tY%n",c,c,c); ^ test4.java:13: cannot resolve symbol symbol : method format (java.lang.String,java.util.Calendar,java.util.Calendar, java.util.Calendar) location: class java.io.PrintStream System.out.format("%tl:%tM %tp%n",c,c,c); ^ test4.java:14: cannot resolve symbol symbol : method format (java.lang.String,java.util.Calendar) location: class java.io.PrintStream System.out.format("%tD%n",c); ^ 3 errors
what is wrong with this code ?
is it necessary to import any other packages ?
please tell me....
Reply With Quote
Sponsored Links