Pages

Square root symbol in java

After i spend a day to find how to print square root symbol in java through command prompt, someone tell me from java forum if our command prompt did not have a glyph for the square root character, this job will undone. But when i try use it in JOptionPane's message box it perform well.

In java "\u221A" is refer to square root symbol. It is Unicode.You can try to visit link below for more details :
Click here

If you want to print square root symbol through your command prompt, you can try something like this. I hope your command prompt can support for this thing.


public class Test2
{
public static void main(String[]args)
{
System.out.println("\u221A");
}
}


If you want to put it in JOptionPane's message box (this is perform well in my computer), you can try this :


import javax.swing.JOptionPane;

public class Test2
{
public static void main(String[]args)
{
JOptionPane.showMessageDialog(null,"\u221A");
}
}
Related Posts Plugin for WordPress, Blogger...