Class ChemicalElement


  • public final class ChemicalElement
    extends java.lang.Object
    Represents an element, that is, a type of atom.

    You do not need to modify this class, but you will need to use its methods.

    • Field Detail

      • HYDROGEN

        public static final ChemicalElement HYDROGEN
        Element 1, hydrogen.
      • FLUORINE

        public static final ChemicalElement FLUORINE
        Element 9, the first halogen, fluorine.
      • CHLORINE

        public static final ChemicalElement CHLORINE
        Element 17, the second halogen, chlorine.
      • BROMINE

        public static final ChemicalElement BROMINE
        Element 35, the third halogen, bromine.
    • Method Detail

      • getSymbol

        public java.lang.String getSymbol()
        Gets the element's symbol on the periodic table.
        Returns:
        The one- or two-letter element symbol.
      • getWeight

        public double getWeight()
        Gets the element's average atomic mass.
        Returns:
        The atomic mass in grams per mole.
      • getValence

        public int getValence()
        Gets the element's valence, that is, how many bonds an atom of this element should have.
        Returns:
        The valence.
      • toString

        public java.lang.String toString()
        Gets a string representation of the element object.
        Overrides:
        toString in class java.lang.Object
        Returns:
        The stringified element.