java练习程序1
/*import javax.swing.JFrame;*/
/*import javax.swing.JOptionPane;*/
public class TestFrame{
public static void main(String[] args) throws Exception{
/*JFrame frame1 = new JFrame();
frame1.setTitle("Windows 1");
frame1.setSize(200,150);
frame1.setLocation(200,100);
frame1.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
frame1.setVisible(true);
JFrame rx = new JFrame();
rx.setTitle("rx's Windows");
rx.setSize(300,300);
rx.setLocation(0,0);
rx.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
rx.setVisible(true);*/
/*String s = "Welcome to java";
String s1 = new String("Welcome to java");
String s2 = s1.intern();
String s3 = "Welcome to java";
System.out.println("s1 == s is" + (s1 == s));
System.out.println("s2 == s is" + (s2 == s));
System.out.println("s.intern() == s3.intern() is" + (s.intern() == s3.intern()));
String s4 = "Welcome";
String s5 = "j a v a";
System.out.println();
System.out.println(s4.toLowerCase());
System.out.println(s4.toUpperCase());
System.out.println(s5.trim());
System.out.println(s4.replace('e','A'));
System.out.println(s4.replaceAll("e","E"));*/
/*System.out.println("Welcome to java".indexOf('W'));
System.out.println("Welcome to java".indexOf('o'));
System.out.println("Welcome to java".indexOf('o',5));
System.out.println("Welcome to java".indexOf("come"));
System.out.println("Welcome to java".indexOf("java",5));
System.out.println("Welcome to java".indexOf("Java",5));
System.out.println("Welcome to java".lastIndexOf('W'));
System.out.println("Welcome to java".lastIndexOf('o'));
System.out.println("Welcome to java".lastIndexOf('o',5));
System.out.println("Welcome to java".lastIndexOf("come"));
System.out.println("Welcome to java".lastIndexOf("java",5));
System.out.println("Welcome to java".lastIndexOf("Java",5));*/
/*char[] chars = "Java".toCharArray();
getChars(int srcBegin,int
相关文档:
Java学习从入门到精通
一、 JDK (Java Development Kit)
JDK是整个Java的核心,包括了Java运行环境(Java Runtime Envirnment),一堆Java工具和Java基础的类库(rt.jar)。不论什么Java应用服务器实质都是内置了某个版本的JDK。因此掌握JDK是学好Java的第一步。最主流的J ......
手动建表:
CREATE TABLE `excel` (
`id` int(11) DEFAULT NULL,
`name` varchar(50) DEFAULT NULL,
`passwd` varchar(50) DEFAULT NULL
) ENGINE=InnoDB DEFAULT CHARSET=gb2312; 注意是gb2312
然后在连接数据库时加上:
useUnicode=true&characterEncoding=gb2312.
就ok啦! ......
本示例从网上下载一本小说,并保存为 UTF-8 格式。
import java.io.BufferedReader;
import java.io.File;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.InputStreamReader;
import java.io.OutputStreamWriter;
import java.io.Writer;
import java.net.MalformedURLException;
......
fm.split("["); // error
-------------------
java.util.regex.PatternSyntaxException: Unclosed character class near index 0[+
^
at java.util.regex.Pattern.error(Unknown Source)
at java.util.regex.Pattern.clazz(Unknown Source)
& ......
Java网络编程初步
Kagula
2009-11-23
关键词
Java Socket DataInputStream DataOutputStream
概要
使用Java同步IO应用程序库,实现CS结构网络编程。
正文
使用Socket来建立网络连接,使用DataInputStream、DataOutputStream来存取网络流。
客户端部份
第一步 ......