Java

From Rohidekar

Jump to: navigation, search

Deprecated

Contents

Javadoc

Inheriting a comment

/** {@inheritDoc} */

Popup Box

JOptionPane.showMessageDialog(
null,
"Invalid choice, please choose again",
"Temperature and Length Conversion Program",
JOptionPane.INFORMATION_MESSAGE);

http://sg.answers.yahoo.com/question/index?qid=20080604211703AA2FMO2

Enabling assertions in multiple specified classes

-ea:java.util.HashMap -ea:java.util.HashSet

Regex matching

    String input = "Unix hath demons and deamons in it!";

    Pattern r = Pattern.compile(regex);
    Matcher m = r.matcher(input);
 
    // NOTE: You MUST call find() otherwise no groups will be populated
    if (m.find())
    {
      String result = m.group(1);
    }

Regex substitution

    String input = "Unix hath demons and deamons in it!";

    Pattern r = Pattern.compile(regex);
    Matcher m = r.matcher(input);

    StringBuffer sb = new StringBuffer();

    String result = m.replaceAll("");
Personal tools