一、不错的学习资源:
1、Data Structure
https://dsa.cs.tsinghua.edu.cn/~deng/ds/index.htm
学堂在线:数据结构
https://next.xuetangx.com/search?query=%E9%82%93%E4%BF%8A%E8%BE%89&page=1
廖雪峰 java教程
https://www.liaoxuefeng.com/wiki/1252599548343744/1279768011997217
二、常用技术入门:
1.1、java与javax的区别分析(转)
https://www.cnblogs.com/EasonJim/p/6993139.html
1.2 Tinking in Java(Java编程思想) 第四版全部习题答案
http://greggordon.org/java/tij4/solutions.htm
1.3 Java反编译工具-JD-GUI
https://www.cnblogs.com/EasonJim/p/7788659.html
下载网址:
http://java-decompiler.github.io/
github网址:https://github.com/java-decompiler
2、Wind10 Tomcat配置,Tomcat第一个网页 Helloworld!
https://blog.csdn.net/woha1yo/article/details/78331727
Tomcat入门之helloWorld
https://blog.csdn.net/qq_30684235/article/details/88140544
安装好Tomcat后,进入其文件夹->webapps->ROOT
新建一个txt文件,命名helloWorld.jsp,打开,在里面输入
<html>
<body>
<center>
Hello World
</center>
</body>
</html>
保存,将后缀改为jsp,打开Tomcat,打开浏览器,输入网址
http://localhost:8080/helloWorld.jsp
就会显示Hello World
3、网页计数
<!DOCTYPE html>
<html>
<head>
<meta charset="utf-8">
<title>统计操作次数</title>
<script>
var a = 0;
function numCount(){
a++;
document.getElementById("demo").innerHTML=a;
}
</script>
</head>
<body>
<h1>我的第一个 JavaScript 程序</h1>
<p>当前计数为:</p>
<p id="demo">0</p>
<button type="button" οnclick="numCount()">增加计数</button>
</body>
</html>
4、tomcat部署简单的html静态网页
https://blog.csdn.net/russ44/article/details/52493531
5、有哪些适合新手练手的Java Web项目?
https://zhuanlan.zhihu.com/p/22112669
JavaWeb学习总结 —!!!!!
https://www.cnblogs.com/xdp-gacl/category/574705.html
6、Servlet 实例
https://www.runoob.com/servlet/servlet-first-example.html
java编译错误 程序包javax.servlet不存在javax.servlet.*
https://www.jianshu.com/p/57f7c9a8d548
javaweb学习总结(六)——Servlet开发(二)
https://www.cnblogs.com/xdp-gacl/p/3763559.html
7、【Spring】IntelliJ IDEA搭建Spring环境 (入门实践)
https://blog.csdn.net/cflys/article/details/70598903
8、spring bean是什么
https://www.awaimai.com/2596.html
9、浅谈Java中的hashcode方法 (很适合入门)
https://www.cnblogs.com/dolphin0520/p/3681042.html
10、Java 访问权限控制:你真的了解 protected 关键字吗?
https://blog.csdn.net/justloveyou_/article/details/61672133
11、windows下安装和配置Redis
https://www.jianshu.com/p/e16d23e358c0
Redis【入门】就这一篇!
https://zhuanlan.zhihu.com/p/37982685
12、使用阿里巴巴的FastJson的一个例子
import java.util.List;
import java.util.ArrayList;
import com.alibaba.fastjson.JSON;
/**
* 使用阿里巴巴FastJson将对象转换成json字符串、将json字符串装换成对象
*
* @author CodeCraft
* @2019-12-14
*/
public class FastJsonDemo {
public static void main(String[] args) {
// 构建用户geust
User guestUser = new User();
guestUser.setName("guest");
guestUser.setAge(28);
// 构建用户root
User rootUser = new User();
rootUser.setName("root");
rootUser.setAge(35);
// 构建用户组对象
UserGroup group = new UserGroup();
group.setName("admin");
group.getUsers().add(guestUser);
group.getUsers().add(rootUser);
//将对象转换为json字符串
String jsonString = JSON.toJSONString(group);
System.out.println("jsonString:"+jsonString);
//将json字符串转换成对象
UserGroup group1 = JSON.parseObject(jsonString, UserGroup.class);
System.out.println(group1);
//数组装换为json字符串
User[] users = new User[2];
users[0] = guestUser;
users[1] = rootUser;
String jsonString1 = JSON.toJSONString(users);
System.out.println("jsonString1:"+jsonString1);
//json字符串转换为List
List<User> user2 = JSON.parseArray(jsonString1, User.class);
System.out.println(user2);
}
private static class User {
private String name;
private int age;
public User() {
super();
// TODO Auto-generated constructor stub
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
@Override
public String toString(){
return "User={ "+"name:"+this.name+", age:"+this.age+" }";
}
}
private static class UserGroup {
private String name;
private List<User> users = new ArrayList<User>();
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public List<User> getUsers() {
return users;
}
public void setUser(List<User> users) {
this.users = users;
}
public UserGroup() {
super();
// TODO Auto-generated constructor stub
}
@Override
public String toString(){
return "UserGroup:{ name="+this.name+", user="+this.users+" }";
}
}
}
https://www.jianshu.com/p/5a8fa12d4cbc
13、Fastjson内幕 – wenshao
https://www.iteye.com/blog/wenshao-1142031
14、idea中查看方法的调用链
https://blog.csdn.net/yinbucheng/article/details/77466613
IntelliJ IDEA中可以在主菜单中选择Navigate | Call Hierarchy命令查看一个Java方法调用树(caller和callee两个方向),但是不像Eclipse那样可以查看类成员变量的调用树。
15、Spring 框架简介
https://www.ibm.com/developerworks/cn/java/wa-spring1/index.html
16、keepalived原理、配置解析及其应用案例(keepalived双机热备实现)
https://blog.csdn.net/Field_Yang/article/details/80055092
https://www.keepalived.org/
nginx实现请求的负载均衡 + keepalived实现nginx的高可用
https://www.cnblogs.com/youzhibing/p/7327342.html
17、时间的3种格式:long/date/String
import java.text.SimpleDateFormat;
import java.util.Date;
public class Main {
public static void main(String[] args) {
//时间的3种格式:long/date/String
Long millSec = System.currentTimeMillis();
System.out.println(millSec);
Date date = new Date(millSec);
System.out.println(date);
String dateFormat = "yyyy-MM-dd HH:mm:ss";
SimpleDateFormat sdf = new SimpleDateFormat(dateFormat);
System.out.println(sdf.format(date));
//date2long
System.out.println(date.getTime());
}
参考:java Data、String、Long三种日期类型之间的相互转换
https://www.cnblogs.com/lgzbj2006/p/5554942.html
Java 把long 转换成 日期 再转换成String类型
https://www.cnblogs.com/Vziiii/p/6402675.html
18、sed 之 \1-9 的作用(设定9种模式)
https://blog.csdn.net/Jasonliujintao/article/details/53509732
sed 之 \1-9 的作用
\1 就代表被匹配到的第一个模式,sed 一共可以记录9个模式。这些模式在某些场景下会非常有用,下面就介绍一下怎样使用。
模式? 就是正则表达式用 () 扩起来的内容
命令行模式下用到了转义字符 和和
先看一行命令:
[www@]$ echo hello123|sed "s/\([a-z]*\).*/\1/"
hello
这里我们看到的是正则匹配到的部分是 hello 这个字符串,替换的模式里面是 \1 , 那么 \1 实际上代表的就是 hello 这个字符串,接下来我们看另外一行命令:
[www@]$ echo hello123|sed 's/\([a-z]*\)\([0-9]\{3\}\)/\2\1/'
123hello
看到没? 本来应该输出 hello123 的,现在被替换成了123hello
这行命令里面有两个模式 ([a-z]*) 对应的是 \1 模式1
([0-9]{3}) 对应的是 \2 模式2, 最后替换的内容里面 \2\1 代表的是
模式2 放到模式1 的前面,这就达到了颠倒字符串的目的。
这样是不是很有趣,记住现在是sed最多可以记录9个模式。
19 、mybatis
https://mybatis.org/mybatis-3/zh/getting-started.html
20、Java占位符
https://blog.csdn.net/gsls200808/article/details/39968749
具体如何使用可以参考官方API文档
http://docs.oracle.com/javase/7/docs/api/
import java.text.MessageFormat;
import java.util.Date;
public class test01 {
public static void main(String[] args) {
System.out.println("hello");// print hello
// %s占位符,输出字符串
String username = "user1";
int num = 3;
System.out.printf("%s您好,您是第%s位访客\n", username, num); // prints user1您好,您是第3位访客
// %f占位符
double d = 1.2;
float f = 1.2f;
System.out.printf("%f %f", d, f); // prints 1.200000 1.200000
// %1$s占位符
//%n$ms:代表输出的是字符串,n代表是第几个参数,设置m的值可以在输出之前放置空格,也可以设为0m,在输出之前放置m个0
System.out.println(String.format("我是%1$s,我来自%2$s,今年%3$s岁", "中国人", "北京",
"22"));
// prints 我是中国人,我来自北京,今年22岁
// {}占位符,{}内的数字代表第几个参数,参数从0开始
String url = "www.baidu.com";
int count = 1000;
System.out.println(MessageFormat
.format("该网站{0}被访问了 {1} 次.", url, count));
// prints 该网站www.baidu.com被访问了 1,000 次.
// {}占位符
String template = "Welcome {0}! Your last login was {1}";
String output = MessageFormat.format(template, new Object[] { "Python",
new Date().toString() });
System.out.println(output);
// prints Welcome Python! Your last login was Fri Oct 10 20:47:00 CST 2014
}
}
21、Java基础——从键盘(控制台)输入字符串(数据)的几种方式详解
https://blog.csdn.net/siying8419/article/details/78735444
(1) Scanner类的调用
package FIRST_Chapter;
import java.util.Scanner;
public class TestScanner {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("请输入字符串:");
while (true) {
String line = s.nextLine();
if (line.equals("ok")) break;
System.out.println(">>>" + line);
}
}
}
(2) BufferedReader类的调用
package FIRST_Chapter;
import java.io.*;
class test{
public static void main(String[] Args){
try{
System.out.println("please input the content that you want to show,end with new line <ok>");
InputStreamReader isr = new InputStreamReader(System.in); //这样是为了将数据传入流中,相当于数据流的入口
BufferedReader br = new BufferedReader(isr);
while(true){
String temp = new String(br.readLine());
System.out.println(">>>"+temp);
if(temp.equals("ok")) break; //注意这个地方不能用等号,用equals
}
System.out.println("the content from your keyboard has been written correctly");
}catch(IOException e){
System.out.println("the file has not record correctly");
}
}
}
22、Java中BufferedReader与Scanner读入的区别
https://blog.csdn.net/zengxiantao1994/article/details/78056243
java.util.Scanner类是一个简单的文本扫描类,它可以解析基本数据类型和字符串。它本质上是使用正则表达式去读取不同的数据类型。
Java.io.BufferedReader类为了能够高效的读取字符序列,从字符输入流和字符缓冲区读取文本。
23、java经典实例 第三版 PDF 下载
http://www.jb51.net/books/577859.html
24、基于Java数组实现循环队列的两种方法小结
https://www.jb51.net/article/130855.htm
25、Java finally 的用法,看这一篇就够了 --明明如月君 2020年01月06日
https://juejin.im/post/5e1346ba5188253a6b371d78
26、Java—List的用法与实例详解
https://blog.csdn.net/yusirxiaer/article/details/76577722
import java.util.ArrayList;
import java.util.Arrays;
import java.util.List;
public class TestList {
/**
* 测试add/remove/size/isEmpty/contains/clear/toArrays等方法
*/
public static void test01() {
List<String> list = new ArrayList<String>();
boolean b = list.isEmpty();
System.out.println(b); // true,容器里面没有元素
list.add("高淇");
System.out.println(list.isEmpty()); // false,容器里面有元素
list.add("高小七");
list.add("高小八");
System.out.println(list);
System.out.println("list的大小:" + list.size());
System.out.println("是否包含指定元素:" + list.contains("高小七"));
System.out.println("指定元素的index:" + list.indexOf("高小七"));
System.out.println("get指定index的元素:" + list.get(1));
list.remove("高淇");
System.out.println(list);
Object[] objs = list.toArray();
System.out.println("转化成Object数组:" + Arrays.toString(objs));
list.clear();
System.out.println("清空所有元素:" + list);
}
public static void main(String[] args) {
test01();
}
}
27、Java中的LinkedList的方法的应用
https://blog.csdn.net/sinat_36246371/article/details/53709625
import java.util.LinkedList;
public class LinkedListMethodsDemo {
public static void main(String[] args) {
LinkedList<String> linkedList = new LinkedList<>();
linkedList.push("first");
linkedList.push("second");
linkedList.push("second");
linkedList.push("third");
linkedList.push("four");
linkedList.push("five");
System.out.println("linkedList: " + linkedList);
System.out.println("linkedList.contains(\"second\"): " + linkedList.contains("second"));
System.out.println("linkedList.contains(\"six\"): " + linkedList.contains("six"));
System.out.println("linkedList.element(): " + linkedList.element());
System.out.println("linkedList: " + linkedList);
System.out.println("linkedList.set(3, \"set\"): " + linkedList.set(3, "set"));
System.out.println("linkedList: " + linkedList);
System.out.println("linkedList.subList(2,4): " + linkedList.subList(2,4));
System.out.println("linkedList: " + linkedList);
}
}
28、由浅入深理解java集合(一)——集合框架 Collection、Map
https://www.jianshu.com/p/589d58033841
import java.util.ArrayList;
import java.util.Collection;
import java.util.Iterator;
public class IteratorExample {
public static void main(String[] args){
//创建集合,添加元素
Collection<Integer> days = new ArrayList<Integer>();
for(int i =0;i<10;i++){
days.add(i);
}
//获取days集合的迭代器
Iterator<Integer> iterator = days.iterator();
while(iterator.hasNext()){//判断是否有下一个元素
int next = iterator.next();//取出该元素
//逐个遍历,取得元素后进行后续操作
System.out.println(next);
}
}
}
29、Java transient关键字使用示例
https://www.jianshu.com/p/2911e5946d5c
import java.io.Serializable;
public class Employee implements Serializable {
private static final long serialVersionUID = -1L;
private String firstName;
private String lastName;
private transient String confidentialInfo;
public void setFirstName(String str) {
firstName = str;
}
public void setLastName(String str) {
lastName = str;
}
public void setConfidentialInfo(String str) {
confidentialInfo = str;
}
public String getFirstName() {
return firstName;
}
public String getLastName() {
return lastName;
}
public String getConfidentialInfo() {
return confidentialInfo;
}
}
import java.io.*;
public class TransSerializationTest {
public static void main(String[ ] args) throws FileNotFoundException {
try {
Employee emp = new Employee();
emp.setFirstName("Chen");
emp.setLastName("ShuaiShuai");
emp.setConfidentialInfo("password");
System.out.println("Read before Serialization:");
System.out.println("firstName: " + emp.getFirstName());
System.out.println("lastName: " + emp.getLastName());
System.out.println("confidentialInfo: " + emp.getConfidentialInfo());
ObjectOutputStream oos = new ObjectOutputStream(new FileOutputStream("E:/chenss.txt"));
//Serialize the object
oos.writeObject(emp);
oos.close();
} catch (Exception e) {
System.out.println(e);
}
try {
ObjectInputStream ooi = new ObjectInputStream(new FileInputStream("E:/chenss.txt"));
//Read the object back
Employee readEmpInfo = (Employee) ooi.readObject();
System.out.println("Read From Serialization:");
System.out.println("firstName: " + readEmpInfo.getFirstName());
System.out.println("lastName: " + readEmpInfo.getLastName());
System.out.println("confidentialInfo: " + readEmpInfo.getConfidentialInfo());
ooi.close();
} catch (IOException e) {
e.printStackTrace();
} catch (ClassNotFoundException e) {
e.printStackTrace();
}
}
}