01.1.3.1序言 00:02:17 01.1.3.2 C语言中的基本元素和常量的概念 00:08:54 01.1.3.3示例--常量 00:12:08 01.1.3.4变量的概念和命名规则 00:09:11 01.1.3.5变量的声明.初始化和定义 00:12:18 01.1.3.6数据类型的概念和分类 00:06:22…
二进制0b开头 八进制0开头 十六进制0x开头 package com.jacky; public class Aserver { public static void main(String args[]) { System.out.println(100);// 十进制 System.out.println(0b100);// 二进制 System.out.println(0100);// 八进制 System.out.println(0x100);// 十六进制 } } 输出: 10046…
4.1 import java.util.Scanner; public class Welcome { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the length from the center to a vertex:"); double r = input.nextDouble(); double s = 2…
链式编程 每次调用方法后,返回的是一个对象 /* * 链式编程 * 每次调用方法后,返回的是一个对象 */ class Student { public void study() { System.out.println("good good study, day day up!"); } } class StudentDemo { public Student getStudent() { return new Student(); } } public class InnerCla…
例10.1说明InetAddress类的用法的应用程序. public class Example10_1 { public static void main(String args[]) { try {// 以下代码通过域名建立InetAddress对象: InetAddress addr = InetAddress.getByName("www.fudan.edu.cn"); String domainName = addr.getHostName();// 获得主机名 Strin…
答案为本人求解,如有错误,还望海涵.如有雷同,纯属巧合. 7.1 import java.util.Scanner; public class Main { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter the number of students: "); int num = input.nextInt(); int sc…
答案为本人自己求解,若有错误,还望海涵并及时告知.如有雷同,纯属巧合. 2.1 import java.util.Scanner; public class Welcome { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a degree in Celsius:"); double celsius = input.next…
例9.1一个文件复制应用程序,将某个文件的内容全部复制到另一个文件. import java.io.*; public class Example9_1 { public static void main(String arg[]) { File inputFile = new File("file1.txt"); File outputFile = new File("file2.txt"); int ch; try { FileReader in = new F…
例8.1应用程序用Thread子类实现多线程. import java.util.Date; public class Example8_1 { static Athread threadA; static Bthread threadB; public static void main(String args[]) { threadA = new Athread(); threadB = new Bthread(); threadA.start(); threadB.start(); } }…
例7.1小应用程序用6种字型显示字符串,显示内容说明本身的字型. import java.applet.*; import java.awt.*; public class Example7_1 extends Applet { Font f1 = new Font("Helvetica", Font.PLAIN, 18); Font f2 = new Font("Helvetica", Font.BOLD, 10); Font f3 = new Font(&quo…