随笔分类 - 文中代码
Java语言程序设计-基础篇-第八版
Java语言程序设计-基础篇-第八版-第九章
摘要:package chapter9字符串和文本IO;import java.util.Scanner;public class PalindromeIgnoreNonAlphanumeric { public static void main(String[] args) { Scanner input = new Scanner(System.in); System.out.print("Enter a string: "); String s = input.nextLine(); System.out.println("Igno...
阅读全文
Java语言程序设计-基础篇-第八版-第八章
摘要:1 package chapter8对象和类; 2 3 public class Circle2 { 4 double radius; 5 static int numberOfObjects = 0; 6 7 Circle2() { 8 radius = 1.0; 9 numberOfObjects++;10 }11 12 Circle2(double newRadius) {13 radius = newRadius;14 numberOfObjects++;15 }16 ...
阅读全文
Java语言程序设计-基础篇-第八版-第七章
摘要:1 package chapter7; 2 3 public class PassTwoDimensionalArray { 4 public static void main (String[] args) { 5 java.util.Scanner input = new java.util.Scanner(System.in); 6 7 int[][] m = new int[3][4]; 8 System.out.println("Enter " + m.length + " rows and " + 9 ...
阅读全文
Java语言程序设计-基础篇-第八版-第六章
摘要:1 package chapter6一维数组; 2 3 public class Arrays类 { 4 public static void main(String[] args){ 5 6 double[] numbers = {6.0, 4.4, 1.9, 2.9, 3.4, 3.5}; 7 java.util.Arrays.sort(numbers); 8 9 int[] list = {2, 4, 7, 10};10 System.out.println(java.util...
阅读全文
Java语言程序设计-基础篇-第八版-第五章
摘要:1 package chapter5方法; 2 //求最大公约数; 3 public class GreatestCommonDivisor { 4 public static void main(String[] args){ 5 java.util.Scanner input = new java.util.Scanner(System.in); 6 7 System.out.print("Enter first integer: "); 8 int n1 = input.nextInt(); 9 ...
阅读全文
Java语言程序设计-基础篇-第八版-第四章
摘要:1 package chapter4; 2 3 public class FutureTuition { 4 public static void main(String[] args){ 5 double tuition = 10000; 6 int year = 1; 7 while (tuition < 20000){ 8 tuition = tuition * 1.07; 9 year++;10 }11 System.out.println("Tuitio...
阅读全文
Java语言程序设计-基础篇-第八版-第三章
摘要:1 package chapter3; 2 import javax.swing.*; 3 public class AdditionTutor { 4 public static void main(String[] args){ 5 int number1 = (int)(System.currentTimeMillis() % 10); 6 int number2 = (int)(System.currentTimeMillis() * 7 % 10); 7 8 String answerString = JOptionPane.showInput...
阅读全文
Java语言程序设计-基础篇-第八版-目录
摘要:第1章 计算机、程序和java概述 1本章小结 15 Java语言程序设计-基础篇-第八版-第一章复习题 15Java语言程序设计-基础篇-第八版-复习题-第一章编程练习题 17Java语言程序设计-基础篇-第八版-编程练习题-第一章第2章 基本程序设计 18本章小结 46Java语言程序设计-基础篇-第八版-第二章复习题 47Java语言程序设计-基础篇-第八版-复习题-第二章编程练习题 50Java语言程序设计-基础篇-第八版-编程练习题-第二章第3章 选择 55本章小结 80Java语言程序设计-基础篇-第八版-第三章复习题 80Java语言程序设计-基础篇-第八版-第三章编程练习题 8
阅读全文
Java语言程序设计-基础篇-第八版-第二章
摘要:1 1 public class ComputeArea { 2 3 public static void main(String[] args){ 4 5 double radius; 6 7 double area; 8 9 radius = 20;10 11 area = radius * radius * 3.14159;12 13 System.out.println("The area for the circle of radius " + radius + " is " + area);14 15 }16 17 }18 19 ...
阅读全文
Java语言程序设计-基础篇-第八版-第一章
摘要:public class Welcome { public static void main(String[] args){ System.out.println("Welcome come to Java!"); } }public class ComputeExpression { public static void main(String[] args){ System.out.println((10.5 + 2 * 3) / (45 - 3.5)); }}import javax.swing.JOptionPane;public class WelcomeIn..
阅读全文
浙公网安备 33010602011771号