double a = 123456, b = 123456.1, c = 123456.12, d = 123456.123, e = 123456.126; Console.WriteLine(a.ToString("N")); //123,456.00 Console.WriteLine(b.T ...
完全数 : 其所有因子的的和等于该数(包括1,但是不包括该数字本身) package judgment;/** * 求1~1000的所有完全数 */public class Judgment { public static void main(String[] args) { for (int i ...
分类:
其他好文 时间:
2021-04-26 13:45:19
阅读次数:
0
写一个java文件 public static void main(String[] args) { String str1="abc"; String str2 ="abc"; String str3=new String("abc"); boolean b1= str1==str2; boole ...
分类:
其他好文 时间:
2021-04-26 13:44:32
阅读次数:
0
import java.util.*; import java.util.regex.Matcher; import java.util.regex.Pattern; public class Problem53 { public static void main(String[] args) { ...
分类:
编程语言 时间:
2021-04-26 13:44:00
阅读次数:
0
桥接模式 桥接模式结构图: 示例代码: // 桥接角色Message接口 public interface Message { void sendMessage(String message, String toUser); } // 具体Message角色Email public class Em ...
分类:
其他好文 时间:
2021-04-26 13:31:33
阅读次数:
0
package com.bjpowernode.java.io; import java.io.*; /* 拷贝目录 */ public class CopyAll { public static void main(String[] args) { // 拷贝源 File srcFile = ne ...
分类:
其他好文 时间:
2021-04-26 13:27:13
阅读次数:
0
var s1 = "hello" ; var s2 = new String("world") JavaScript String 对象: https://www.w3school.com.cn/jsref/jsref_obj_string.asp ...
分类:
Web程序 时间:
2021-04-26 13:24:50
阅读次数:
0
可变参数 一个方法中只能指定一个可变参数,它必须是方法的最后一个参数。任何普通的参数必须在它之前声明。 public class ChangeableParam { public static void main(String[] args) { double[] arr = new double[ ...
分类:
其他好文 时间:
2021-04-26 13:20:43
阅读次数:
0
命令行传参 package test4; public class CommandLineParam { public static void main(String[] args) { for (int i=0; i<args.length; i++){ System.out.println("a ...
分类:
其他好文 时间:
2021-04-26 13:20:29
阅读次数:
0
适配器模式 适配器模式结构图: 示例代码: // 已有登录类实现 public class PassportService { public String regist(String userName, String password){ System.out.println("注册成功====== ...
分类:
其他好文 时间:
2021-04-26 13:19:58
阅读次数:
0