`
time心语13
  • 浏览: 4219 次
  • 性别: Icon_minigender_1
社区版块
存档分类
最新评论
  • zuozhimin: 燕喜,你这段时间成长很快,学习上我们都看到了你的努力!继续保持 ...
    心有所感

浅析java网络编程

阅读更多

         Socket简称套接字,用于实现网络上客户和服务器之间的连接,也就是说网络上两个或两个以上通信的进程间总有一个连接,这个连接的端点称为套接字,套接字是比较低层次上的通信,不同操作系统对Scoket有不同的支持方式,不同的开发工具,对Socket的实现也均不相同,而且Scoket在TCP与UDP两大协议族系中有各自的工作方式。

 

           网络中互相通信的两端,其中提供服务的一端叫服务器,而请求服务的一端叫客户机。Scoket通常用来实现Client/Server设计过程,所谓Client/Server是指通信双方一方作为服务器(Server)等待客户(Client)提出请求并予以响应。客户则在需要服务时向服务器提出申请。服务器监听网络端口,一旦有客户请求,就会启动一个服务进程来响应客户,同时继续监听服务端口,使其他客户的请求也能及时得到处理。一般连接过程是:Server端监听某个端口(port)是否有连接请求,Client端向Server端发出连接(Connect)请求,Server端向Client端发出接受(Accept)消息,一个连接就建立起来了。Server端和Client端都可以通过Send,Write等方法与对方通信。

        在java中实现Scoket通讯:

        首先在服务器端创建ServerSocket类对象,来创建服务器对象,其格式如下:

        ServerSocket 服务器对象名 = new ServerSocket(端口号);

通过调用accept()方法来创建一个Scoket对象,其格式如下:

        Scoket 对象名 = 服务器对象名.accept();

服务器端可以用利用这个Scoket对象与客户端进行通讯,通过Scoket对象拿到输入输出流。在所有通信结束后,关闭输入输出流,再关闭Scoket。

 

        服务器和客户端属于两个不同项目

        以下是服务器类代码的实现:(MyServer类和ServerThread类在同一个项目包中)

 

 

import java.io.IOException;

import java.net.ServerSocket;

import java.net.Socket;

import java.util.ArrayList;

import java.util.HashMap;

import java.util.Map;

 

/**

 * 服务器类

 *

 */

public class MyServer {

//队列保存对象

public static ArrayList<ServerThread> list  = new ArrayList<ServerThread>();

 

//Map定义用户名密码集合

public static Map<String,String> userInfoMap = new HashMap<String,String>();

 

 

 

public static void main(String[] args) {

//初始化用户登录信息

for(int i=0;i<5;i++){

userInfoMap.put("user"+i, "pwd"+i);

}

MyServer ms = new MyServer();

ms.initServer(9090);

}

public void initServer(int port){

boolean flag = true;

try {

//创建服务器套接字对象,并给定端口号

ServerSocket server = new ServerSocket(port);

System.out.println("服务器创建成功,端口号为"+port+",等待客户机连接");

 

while(flag){

//等待客户机连接服务器

Socket socket = server.accept();

System.out.println("客户机连接成功!");

//创建服务器线程对象

ServerThread st = new ServerThread(socket);

list.add(st);

st.start();

}

server.close();

} catch (IOException e) {

e.printStackTrace();

}

}

}

 

 

import java.io.BufferedReader;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.OutputStream;

import java.net.Socket;

 

import com.huaxin.client.CommonNet;

/**

 * 服务器线程对象

 */

public class ServerThread extends Thread{

public Socket socket;

public InputStream ins;

public OutputStream ous;

public ServerThread(Socket socket){

this.socket = socket;

}

public void run() {

try{

//拿到输入输出流

ins= socket.getInputStream();

ous =socket.getOutputStream();

 

//把字节流封装为字符流

InputStreamReader isReader = new InputStreamReader(ins);

BufferedReader read = new BufferedReader(isReader);

 

//发送消息给客户机

String msg = "欢迎连接服务器!\r\n";

CommonNet.sendMsg(ous,msg);

 

String user_msg = "请输入用户名:\r\n";

CommonNet.sendMsg(ous,user_msg);

//接收客户端发送过来的用户名

String username = read.readLine();

String user_pwd = "请输入密码:\r\n";

CommonNet.sendMsg(ous,user_pwd);

//接收客户端发送过来的用户名

String password = read.readLine();

 

//验证是否登录成功

if(MyServer.userInfoMap.containsKey(username)){

String pwd = MyServer.userInfoMap.get(username);

if(pwd.equals(password)){

CommonNet.sendMsg(ous,"true\r\n");

//循环读取消息

String value = "";

while(!"bye".equals(value)){

value = CommonNet.readMsg(ins);

System.out.println("客户机说:"+value);

//把读取到的消息转发到其他客户

CommonNet.castMsg(this,username+"说:"+value);

}

}else{

CommonNet.sendMsg(ous,"false\r\n");

}

}else{

CommonNet.sendMsg(ous,"false\r\n");

}

 

//关闭相关链接

ous.flush();

ous.close();

ins.close();

socket.close();

}catch(Exception e){

e.printStackTrace();

}

}

 

}

 

 

         下面是客户端类代码的实现:(MyClient类和CommonNet类属于同一项目的包中)

 

 

import java.io.BufferedReader;

import java.io.InputStream;

import java.io.InputStreamReader;

import java.io.OutputStream;

import java.net.Socket;

import java.util.Scanner;

 

public class MyClient {

public static void main(String[] args) {

//连接服务器

try {

Socket client = new Socket("localhost",5656);

InputStream ins = client.getInputStream();

OutputStream ous = client.getOutputStream();

 

//把字节流封装为字符流

InputStreamReader isReader = new InputStreamReader(ins);

BufferedReader read = new BufferedReader(isReader);

//读取欢迎

String value = read.readLine();

System.out.println(value);

//读取请输入用户名

String value1 = read.readLine();

System.out.println(value1);

//发送消息

Scanner scan = new Scanner(System.in);

String scan_value = scan.nextLine();

CommonNet.sendMsg(ous, scan_value+"\r\n");

 

value1 = read.readLine();

System.out.println(value1);

scan_value = scan.nextLine();

CommonNet.sendMsg(ous, scan_value+"\r\n");

 

if("true".equals(read.readLine())){

System.out.println("登录成功");

}else{

System.out.println("登录失败");

}

 

ins.close();

ous.close();

client.close();

} catch (Exception e) {

e.printStackTrace();

}

}

 

}

 

 

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

import java.io.InputStream;

import java.io.OutputStream;

import com.huaxin.server.MyServer;

import com.huaxin.server.ServerThread;

 

public class CommonNet {

/**

* @param ous

* @param msg

* @throws Exception

*/

public static void sendMsg(OutputStream ous,String msg) throws Exception{

byte[] bytes = msg.getBytes();

ous.write(bytes);

}

/**

* @param ins

* @return

* @throws Exception

*/

public static String readMsg(InputStream ins) throws Exception{

//接收客户机发送的消息

int readByte = ins.read();

String value = "";

StringBuffer sb = new StringBuffer();

//循环读取字节

while(readByte!=13){

sb.append((char)readByte);

readByte = ins.read();

}

//String.trim()去除字符串前后空格回车

value = sb.toString().trim();

return value;

}

/**

* @param st

* @param value

* @throws Exception

*/

public static void castMsg(ServerThread st,String value) throws Exception{

for(int i=0;i<MyServer.list.size();i++){

OutputStream list_ous = MyServer.list.get(i).ous;

if(MyServer.list.get(i)!=st){

sendMsg(list_ous,value+"\r\n");

}

}

}

}

 

 

分享到:
评论

相关推荐

    浅析Java GUI编程工具集.pdf

    浅析Java GUI编程工具集 本文主要介绍了Java GUI编程的三个主要工具集:AWT、Swing和SWT,并对其优缺点进行了比较。下面将对标题、描述、标签和部分内容进行详细的解释和分析。 标题: 浅析Java GUI编程工具集 ...

    JAVA高级编程资料

    这份"JAVA高级编程资料"涵盖了多线程、网络编程、文件与流以及集合类等重要主题,这些都是JAVA开发中不可或缺的部分。 首先,多线程是现代应用中并发执行任务的基础。JAVA提供了丰富的API来支持多线程编程,如...

    浅析用Java编程实现RSA算法的过程.pdf

    Java是一种广泛应用于网络编程领域的编程语言,而RSA算法是一种公钥密码体制,在信息安全领域占据重要地位。本文将深入探讨如何使用Java语言实现RSA加密算法的过程,以及Java语言的发展历程和特点。 Java语言...

    浅析JAVA编程中异常处理的方法与技巧.pdf

    浅析JAVA编程中异常处理的方法与技巧.pdf

    浅析计算机软件JAVA编程的特点及应用.pdf

    Java编程语言作为一种被广泛使用的计算机编程语言,它的发展和应用与计算机技术的进步紧密相连。Java语言自1995年推出以来,一直活跃在软件开发领域,并随着互联网技术的迅速发展而变得更加重要。Java的简单性、可...

    技术浅析.pdf 知识领域 Javase javaee Java技术浅析 技术关键词 JAVA语言 编程技术框架 原理

    Java技术浅析主要介绍了Java语言的技术关键词、编程技术框架、原理等知识点。 一、异常和异常调用链 Java中有两种类型的异常:自定义异常和系统默认定义的异常。自定义异常是指开发者根据项目需要定义的异常,返回...

    浅析JAVA语言的开发平台及J2EE编程技术.pdf

    浅析JAVA语言的开发平台及J2EE编程技术.pdf

    浅析用Java编程实现RSA算法的过程.zip

    本篇文章将深入浅析如何使用Java编程实现RSA算法的过程。 1. RSA算法原理 RSA算法基于两个大素数的乘积难以因式分解的数学难题。公钥是由这两个大素数的乘积以及欧拉函数φ(n)(其中n为两个素数之积)计算出的模反...

    浅析Java学习中的“短板”.pdf

    浅析 Java 学习中的“短板” Java 是一种流行的面向对象的编程语言,广泛应用于软件开发、Android 应用开发、Web 开发等领域。然而,在 Java 学习过程中,初学者容易出现一些“短板”,即一些被忽视或不了解的重要...

    浅析JAVA编程中异常处理的方法与技巧.zip

    在Java编程中,异常处理是一项至关重要的技能,它关乎程序的稳定性和健壮性。本文将深入探讨Java异常处理的基本概念、方法以及一些实用技巧,帮助开发者更好地理解和应用这一核心特性。 异常是程序运行过程中遇到的...

    浅析Java的发展现状与趋势.pdf

    浅析Java的发展现状与趋势 Java是当今最流行的编程语言之一,自1995年由SUN公司发布以来,Java đã经历了多年的发展和演变。近年来,随着Oracle公司收购SUN公司,Java的发展方向和趋势备受关注。本文将对Java的...

    浅析Java异常处理机制.pdf

    浅析Java异常处理机制 在 Java 编程中,异常处理机制是非常重要的一部分。任何一种程序设计语言编写的程序,在运行期间都有可能会出现一个不可能执行的操作,该操作的结果会导致程序运行错误。我们可以使用异常处理...

    浅析Java_Concurrency

    在分析Java并发机制之前,首先需要了解并发编程的重要性和复杂性。Java并发机制是Java语言特性中的精髓所在,它允许开发者利用多线程高效地执行任务,提高程序的执行效率。在多线程环境中,正确地使用并发控制可以...

    浅析Java Applet技术在网络管理中的研究及应用.pdf

    Java Applet技术在网络管理中的应用与研究是一个专业性强的话题,涉及到网络技术、Java编程以及Applet小程序的特性等多个领域。从提供的文件内容来看,本篇文章主要从网络管理的概述、网络管理体系结构、Java Applet...

    浅析若干Java序列化工具编程开发技术共13页.pdf.z

    标题中的“浅析若干Java序列化工具编程开发技术”表明,这份资料主要关注的是Java编程中的序列化技术,这是Java开发中的一个重要概念。序列化是将对象的状态转换为可存储或可传输的形式的过程,这对于持久化数据、...

    浅析Java引用类型和方法参数传递

    ### 浅析Java引用类型和方法参数传递 #### 一、引言 在Java编程语言中,理解数据类型的处理方式对于编写高效、可维护的代码至关重要。本文将深入探讨Java中的引用类型及其如何影响方法参数的传递机制。通过具体实例...

    浅析Java企业开发.pdf

    "浅析Java企业开发" 本文将对Java企业开发的现状和发展趋势进行探讨,并对Struts、Hibernate、MyBatis和Spring这些开源框架进行分析。 首先, Java企业开发存在技术陈旧、保守,交付周期长,对新技术、新趋势的...

    浅析计算机软件JAVA编程的特点及应用.zip

    Java编程语言自1995年发布以来,一直以其跨平台、面向对象和安全性等特点深受全球程序员的喜爱。本文将深入探讨Java在计算机软件开发中的特点及其广泛应用。 首先,Java的跨平台特性是其最大的亮点之一。Java采用了...

    浅析Java8的函数式编程

    "浅析Java8的函数式编程" Java8的函数式编程是Java语言中的一个重要特性,它允许开发者使用函数式编程的思想来编写代码,从而提高代码的可读性、可维护性和性能。在本文中,我们将深入探讨Java8的函数式编程,了解...

    浅析JAVA与C++的区别.pdf

    "浅析JAVA与C++的区别" Java和C++是两种最流行的程序设计语言,它们之间有很多的相似之处,但同时也存在很多的区别。下面我们将从技术角度对这两种语言的区别进行分析。 一、继承 C++支持类的多继承,而Java采用...

Global site tag (gtag.js) - Google Analytics