Trying to compile a Java program
Before using software eclipse compiled a simple Hello Java program, because the software operation is simple, and later learned to use the command character to compile the program. The code is as follows
public class ABC
{
public static void Main (string[] args)
{
System.out.println ("Hello java! ");
}
}
Then use the debug command to jump to the folder to compile successfully
Later read the book on the bit operations related knowledge, respectively is &and, |or, ^xor, ~ complement. The format control symbol%d is output in decimal integer format and can be used with byte, short, int, long, and so on. Compile according to the knowledge in the book, the code is as follows. function System.out.ptintln (""); you can output many characters in a format, or you can mix output, but printf cannot.
Package java2;
public class HH {
public static void Main (string[] args)
{
System.out.println ("and Operation:");
System.out.printf ("0 and 0%5d%n", 0 & 1);
System.out.printf ("0 and 1%5d%n", 0 & 1);
System.out.printf ("1 and 0%5d%n", 1 & 0);
System.out.printf ("1 and 1%5d%n", 1 & 1);
System.out.println ("\nor operation:");
System.out.printf ("0 OR 0%6d%n", 0 | 1);
System.out.printf ("0 OR 1%6d%n", 0 | 1);
System.out.printf ("1 OR 0%6d%n", 1 | 0);
System.out.printf ("1 OR 1%6d%n", 1 | 1);
System.out.println ("\nxop operation:");
System.out.printf ("0 XOR 0%5d%n", 1 ^ 1);
System.out.printf ("0 XOR 1%5d%n", 1 ^ 1);
System.out.printf ("1 XOR 0%5d%n", 1 ^ 1);
System.out.printf ("1 XOR 1%5d%n", 1 ^ 1);
}
}
However, when the command is compiled, the first line of the package java2 need to be deleted before it can be compiled (but not very clear principle)
Try to edit a Java program