Element element = document.getDocumentElement(); short nodeType = element.getNodeType(); System.out.println("Node type: " + nodeType);
Node node = document.createTextNode("Hello, world!"); short nodeType = node.getNodeType(); System.out.println("Node type: " + nodeType);In this example, we create a new text node and then use `getNodeType()` to get the node type of the node. The output will be the node type of the text node, which is usually 3. The `getNodeType` method is part of the `Node` interface in the `org.w3c.dom` package.