随笔分类 - Java学习之多线程、网络编程、Lambda表达式
摘要:定义接口 public interface StudentBuilder { Student build(String name, int age); } View Code 测试类 public class StudentDemo { public static void main(String[
阅读全文
摘要:接口定义 public interface MyString { String mySubString(String s,int x,int y); } View Code 测试类 public class MyStringDemo { public static void main(String[
阅读全文
摘要:接口定义 public interface Print { void printUpperCase(String s); } View Code PrintString类 public class PrintString { public void printUpper(String s){ Str
阅读全文
摘要:接口定义 public interface Converter { int convert(String s); } View Code 测试类定义 public class ConverterDemo { public static void main(String[] args) { //使用L
阅读全文
摘要:接口定义 public interface Printable { void printString(String s); } 测试类 public class PrintableDemo { public static void main(String[] args) { //使用Lambda表达
阅读全文
摘要:接口定义 public interface Addable { int add(int x , int y); } public interface Flyable { void fly(String s); } View Code 测试类定义 public class LambdaDemo { p
阅读全文
摘要:接口定义 public interface Addable { int add(int x, int y); } View Code 测试类定义 public class AddableDemo { public static void main(String[] args) { //匿名内部类 /
阅读全文
摘要:接口定义 public interface Flyable { void fly(String s); } View Code 测试类 public class FlyableDemo { public static void main(String[] args) { //使用匿名内部类 useF
阅读全文
摘要:接口定义 public interface Eatable { void eat(); } View Code 接口实现类 public class EatableImp implements Eatable{ @Override public void eat() { System.out.pri
阅读全文
摘要:public class LambdaDemo { public static void main(String[] args) { //正常实现一个多线程程序 MyRunnable mr = new MyRunnable(); Thread t = new Thread(mr); t.start(
阅读全文
摘要:客户端代码: public class ClientDemo { public static void main(String[] args) throws IOException { //创建客户端Scoket对象 Socket s= new Socket("192.168.50.76",4444
阅读全文
摘要:客户端代码: public class ClientDemo { public static void main(String[] args) throws IOException { //创建客户端Socket对象 Socket s = new Socket("192.168.50.76", 33
阅读全文
摘要:客户端代码: public class ClientDemo { public static void main(String[] args) throws IOException { //创建客户端Socket对象 Socket s= new Socket("192.168.50.76",2222
阅读全文
摘要:客户端代码: public class ClientDemo { public static void main(String[] args) throws IOException { //创建客户端Socket对象 Socket s = new Socket("192.168.50.76",111
阅读全文
摘要:客户端代码: public class ClientDemo { public static void main(String[] args) throws IOException { //创建客户端Socket对象 Socket s= new Socket("192.168.50.76",1234
阅读全文
摘要:客户端代码: public class ClientDemo { public static void main(String[] args) throws IOException { //创建客户端Sokcet Socket s = new Socket("192.168.50.76", 1999
阅读全文
摘要:客户端代码: public class ClientDemo { public static void main(String[] args) throws IOException { //创建客户端的Socket对象 Socket s = new Socket("192.168.50.76",12
阅读全文
摘要:发送端代码: /* UDP发送数据:数据来自于键盘录入,如果输入的数据是886,发送数据结束 */ public class SendDemo { public static void main(String[] args) throws IOException { //1.创建发送端对象 Data
阅读全文
摘要:public class ReceivedDemo { public static void main(String[] args) throws IOException { //1.创建接收端Socket对象 DatagramSocket ds = new DatagramSocket(10086
阅读全文
摘要:public class SendDemo { public static void main(String[] args) throws IOException { //1.创建发送端Socket对象 // DatagramSocket()构造数据报套接字并将其绑定到本地主机上的任何可用端口。 D
阅读全文