This week's book giveaway is in the Mac OS forum.
We're giving away four copies of a choice of "Take Control of Upgrading to Yosemite" or "Take Control of Automating Your Mac" and have Joe Kissell on-line!
See this thread for details.
The moose likes Beginning Java and the fly likes Locale Class Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login


JavaRanch » Java Forums » Java » Beginning Java
Bookmark "Locale Class" Watch "Locale Class" New topic
Author

Locale Class

Jitendra Jha
Ranch Hand

Joined: Jan 28, 2007
Posts: 91
I was trying to work through this code

import java.util.*;
import java.text.*;

class LocaleC
{

public static void main(String[] srt)
{
Calendar cc=Calendar.getInstance();
cc.set(1998,04,19);
Date d=cc.getTime();
System.out.println(d);

Locale lc=new Locale("it","IT");
DateFormat df=DateFormat.getDateInstance(DateFormat.FULL,lc);
String s=df.format(d);
System.out.println(d);

}
}



this code is supposed to give me locale specific information about Italy which it does not.
I am unable to figure out my mistake.Please help

Jitendra


Jitendra
SCJP1.5
SCWCD1.5
Jitendra Jha
Ranch Hand

Joined: Jan 28, 2007
Posts: 91
Sorry, i figured out my mistake
It was the wrong print statement on the last line.
I should have passed s instead of d
Sorry again to have wasted your precious time

Jitendra
 
GeeCON Prague 2014
 
subject: Locale Class