2
package linguagem;
import java.util.*;
public class Linguagem {
public static void main(String[] args) {
Locale locale = new Locale("PORTUGUESE", "PT");
System.out.println("Linguagem: " + locale.getDefault());
}
}
With the locale.getDefault() returning en_US, the use of Locale("PORTUGUESE", "PT"), however, if I just let Locale(), Netbeans Returns Me Error.
And if I leave the string empty: Locale("", ""), It works, but it looks like.
I wanted to know if there is another way to write this code, without having to leave the variable empty.

new Locale("portuguese", "pt")nay returns a locale that corresponds to the Portuguese language. The problem is that the constructor does not validate the entry and accepts anything. Correct for Portuguese from Portugal isnew Locale("pt", "PT")– hkotsubo