摘要:1002 A+B for Polynomials This time, you are supposed to find A+B are two polynomials. Input Specification: Each input file contains one test case.Each
阅读全文
随笔分类 - Java
摘要:1002 A+B for Polynomials This time, you are supposed to find A+B are two polynomials. Input Specification: Each input file contains one test case.Each
阅读全文
摘要:字符串转化为整形 Java中有两个可选的方法用来将字符串转成整型。 一个是Integer.parseInt(),另外一个是Ingeger.valueOf()。 这两个方法都是java.lang.Integer类中的静态方法。 当输入的字符串不是有效的整数,这两个方法都会抛出NumberFormatE
阅读全文
摘要:1001 A+BFromat Calculate a+b and output the sum in standard format -- that is,the diits must be seperated into groups of three commas (unless there ar
阅读全文
摘要:Objects: 1.Create inner classes 2.Implement type casting Java provides following four types of inner class:Regular Inner Class Static inner class Meth
阅读全文
摘要:1001 A+B Format 题目:Calculate a+b and output the sum in standard formatthat is,the digits must be seperated into groups of three by commas (unless ther
阅读全文
摘要:jdbc到数据库官网下载 四种类型的驱动程序: JDBC-ODBC Bridge driver Native-API driver Network Protocol driver (*)Native Protocol driver JDBC API: DriverManage class : Dri
阅读全文
摘要:操作文件和目录 1.建立文件或目录 1 import java.nio.file.Files; 2 import java.nio.file.Path; 3 import java.nio.file.Paths; 4 import java.nio.file.attribute.FileAttrib
阅读全文
摘要:1.向玩家显示菜单(玩游戏,查看说明,查看百分百,退出) 操作步骤:1.建立包,类如上: 在FileOperation.java: 1 package game; 2 import java.io.*; 3 import javax.swing.JOptionPane; 4 public class
阅读全文
摘要:file input stream:(n次外层往内存读取) 1.在本地建立text文本文件: 2.在eclipse中输入代码: 1 import java.io.FileInputStream; 2 import java.io.IOException; 3 4 public class FileI
阅读全文
摘要:1 package simulation; 2 3 import java.util.Random; 4 5 class Vehicle implements Runnable{ 6 private int id; 7 private static TollBooth toll =new TollB
阅读全文
摘要:不带生产者和消费者之间的通信: 1 2 class SynchronizedMethods{ 3 int d; 4 synchronized void getDate() { 5 System.out.println("Got data:"+d); 6 } 7 synchronized void p
阅读全文
摘要:示例代码: 多线程,并设置优先级: 1 package signal; 2 3 4 class A extends Thread{ 5 public void run(){ 6 for(int i=1;i<=3;i++){ 7 System.out.println("a" +i); 8 } 9 }
阅读全文
摘要:方法一: 1 package C5; 2 3 import java.awt.Color; 4 import java.awt.Font; 5 6 import javax.swing.JFrame; 7 import javax.swing.JLabel; 8 import javax.swing
阅读全文
摘要:1.Using the Comparable Interface 示例代码: 测试结果: 1.Using the Comparator Interface 示例代码: 测试结果:
阅读全文
摘要:1.working with the ArrayDeque Class 1 package self; 2 3 import java.util.ArrayDeque; 4 5 //import java.util.Hashtable; 6 7 public class ArrayDequeDemo
阅读全文
摘要:1.HashMap Class 示例代码: 1 package self; 2 3 import java.util.HashMap; 4 5 public class HashMapDemo { 6 public static void main(String args[]) { 7 HashMa
阅读全文
摘要:1.ArrayList 是一个可改变大小的数组.当更多的元素加入到ArrayList中时,其大小将会动态地增长.内部的元素可以直接通过get与set方法进行访问,因为ArrayList本质上就是一个数组.不同步(就是线程不安全) ArrayList是一个动态数组,也是我们最常用的集合。它允许任何符合
阅读全文
|