Java Cross-Platform, dialog box, binary data printing

Source: Internet
Author: User

Java Cross-platform

public class Javatest{public static void Main (string[] args) {System.out.println ("Java Test for Windows/linux");}}

Under the Windows,linux platform,

Use Javac Javatest.java; The Java javatest command was tested and passed smoothly. The javatest.class generated in the middle of the compilation can be interpreted and executed in different JVM virtual machines.

Dialog swing is a development kit for developing the Java application user interface.

Import javax.swing.*;p ublic class javadialog{public static void Main (string[] args) {Joptionpane.showmessagedialog ( NULL, "Hello Javadialog");}}

Java Javadialog Run:


Binary Data printing

public class binarystring{static string bstring (int num) {string result = ""; StringBuffer sb = new StringBuffer (""), int zerosnumber = Integer.numberofleadingzeros (num), while (zerosnumber--! = 0) { Sb.append ("0");} result = Sb.tostring () +integer.tobinarystring (num); return result;} public static void Main (string[] args) {int x = 10; System.out.println ("x=" +x+ "(" +bstring (x) + ")")//f:\java-tmp>java binarystring//x=10 ( 00000000000000000000000000001010)}}


Java Cross-Platform, dialog box, binary data printing

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.