
正文
java源代码之家 java程序源代码
提示:扫一扫查出行【扫一扫了解最新限行尾号】
复制提示
java程序员经常去哪些网上社区论坛?
1、开源中国:开源技术社区java源代码之家,形成java源代码之家了由开源软件库、代码分享、资讯、协作翻译、码云、众包、招聘等几大模块内容,对于java程序员来说主要以开源工程为主,因为没有大规模java源代码之家的用户测评,质量好坏也是需要读者自行把握java源代码之家;
开源中国社区论坛
2、CSDN:专业IT技术社区,包含原创博客、精品问答、职业培训、技术论坛、资源下载等产品服务,其中有不少都是java程序员喜欢的内容,但是比较散乱,需要读者自行审视内容的质量java源代码之家;
CSDN社区论坛
3、Teemlink:专业低代码开发平台技术社区,包含了低代码平台使用教程、低代码平台改进意见、低代码平台问题锦囊、低代码开发平台实施案例、低代码开发平台免费下载等技术交流和问题解决服务,会员人数超30000+,活跃度也比较高,Java程序员们不应该错过这么火热的东西哦;
Teemlink低代码平台社区论坛
相关问答
Q1: 什么是java源代码 怎么查看
你说的java源代码是指编译成的class文件前的java文件。
当我们运行.java文件时,它会被系统编译成.class文件,例如Test.java编译之后就是Test.class,
源文件就是指Test.java文件,
一般部署项目时,有.class文件就可以发布运行了,但是如果想修改这个系统,.class是不能修改的,要有.java文件才能修改
也可以上网去下反编译软件,就是能把.class文件大部分还原成.java文件的工具,但不是100%还原,而且如果不是正版的,小心有毒啊,什么的。
Q2: java聊天室源代码去哪里看更好?
【ClientSocketDemo.java 客户端Java源代码】 import java.net.*; import java.io.*; public class ClientSocketDemo { //声明客户端Socket对象socket Socket socket = null; //声明客户器端数据输入输出流 DataInputStream in; DataOutputStream out; //声明字符串数组对象responsejava源代码之家,用于存储从服务器接收到java源代码之家的信息 String response[]; //执行过程中java源代码之家,没有参数时的构造方法java源代码之家,本地服务器在本地,取默认端口10745 public ClientSocketDemo() { try { //创建客户端socket,服务器地址取本地,端口号为10745 socket = new Socket("localhost",10745); //创建客户端数据输入输出流,用于对服务器端发送或接收数据 in = new DataInputStream(socket.getInputStream()); out = new DataOutputStream(socket.getOutputStream()); //获取客户端地址及端口号 String ip = String.valueOf(socket.getLocalAddress()); String port = String.valueOf(socket.getLocalPort()); //向服务器发送数据 out.writeUTF("Hello Server.This connection is from client."); out.writeUTF(ip); out.writeUTF(port); //从服务器接收数据 response = new String[3]; for (int i = 0; i response.length; i++) { response[i] = in.readUTF(); System.out.println(response[i]); } } catch(UnknownHostException e){e.printStackTrace();} catch(IOException e){e.printStackTrace();} } //执行过程中,有一个参数时的构造方法,参数指定服务器地址,取默认端口10745 public ClientSocketDemo(String hostname) { try { //创建客户端socket,hostname参数指定服务器地址,端口号为10745 socket = new Socket(hostname,10745); in = new DataInputStream(socket.getInputStream()); out = new DataOutputStream(socket.getOutputStream()); String ip = String.valueOf(socket.getLocalAddress()); String port = String.valueOf(socket.getLocalPort()); out.writeUTF("Hello Server.This connection is from client."); out.writeUTF(ip); out.writeUTF(port); response = new String[3]; for (int i = 0; i response.length; i++) { response[i] = in.readUTF(); System.out.println(response[i]); } } catch(UnknownHostException e){e.printStackTrace();} catch(IOException e){e.printStackTrace();} } //执行过程中,有两个个参数时的构造方法,第一个参数hostname指定服务器地址 //第一个参数serverPort指定服务器端口号 public ClientSocketDemo(String hostname,String serverPort) { try { socket = new Socket(hostname,Integer.parseInt(serverPort)); in = new DataInputStream(socket.getInputStream()); out = new DataOutputStream(socket.getOutputStream()); String ip = String.valueOf(socket.getLocalAddress()); String port = String.valueOf(socket.getLocalPort()); out.writeUTF("Hello Server.This connection is from client."); out.writeUTF(ip); out.writeUTF(port); response = new String[3]; for (int i = 0; i response.length; i++) { response[i] = in.readUTF(); System.out.println(response[i]); } } catch(UnknownHostException e){e.printStackTrace();} catch(IOException e){e.printStackTrace();} } public static void main(String[] args) { String comd[] = args; if(comd.length == 0) { System.out.println("Use localhost(127.0.0.1) and default port"); ClientSocketDemo demo = new ClientSocketDemo(); } else if(comd.length == 1) { System.out.println("Use default port"); ClientSocketDemo demo = new ClientSocketDemo(args[0]); } else if(comd.length == 2) { System.out.println("Hostname and port are named by user"); ClientSocketDemo demo = new ClientSocketDemo(args[0],args[1]); } else System.out.println("ERROR"); } } //////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////////// 【ServerSocketDemo.java 服务器端Java源代码】 import java.net.*; import java.io.*; public class ServerSocketDemo { //声明ServerSocket类对象 ServerSocket serverSocket; //声明并初始化服务器端监听端口号常量 public static final int PORT = 10745; //声明服务器端数据输入输出流 DataInputStream in; DataOutputStream out; //声明InetAddress类对象ip,用于获取服务器地址及端口号等信息 InetAddress ip = null; //声明字符串数组对象request,用于存储从客户端发送来的信息 String request[]; public ServerSocketDemo() { request = new String[3]; //初始化字符串数组 try { //获取本地服务器地址信息 ip = InetAddress.getLocalHost(); //以PORT为服务端口号,创建serverSocket对象以监听该端口上的连接 serverSocket = new ServerSocket(PORT); //创建Socket类的对象socket,用于保存连接到服务器的客户端socket对象 Socket socket = serverSocket.accept(); System.out.println("This is server:"+String.valueOf(ip)+PORT); //创建服务器端数据输入输出流,用于对客户端接收或发送数据 in = new DataInputStream(socket.getInputStream()); out = new DataOutputStream(socket.getOutputStream()); //接收客户端发送来的数据信息,并显示 request[0] = in.readUTF(); request[1] = in.readUTF(); request[2] = in.readUTF(); System.out.println("Received messages form client is:"); System.out.println(request[0]); System.out.println(request[1]); System.out.println(request[2]); //向客户端发送数据 out.writeUTF("Hello client!"); out.writeUTF("Your ip is:"+request[1]); out.writeUTF("Your port is:"+request[2]); } catch(IOException e){e.printStackTrace();} } public static void main(String[] args) { ServerSocketDemo demo = new ServerSocketDemo(); } } java源代码之家你可以去这里看看
Q3: JAVA代码
连连看java源代码
import javax.swing.*;
import java.awt.*;
import java.awt.event.*;
public class lianliankan implements ActionListener
{
JFrame mainFrame; //主面板
Container thisContainer;
JPanel centerPanel,southPanel,northPanel; //子面板
JButton diamondsButton[][] = new JButton[6][5];//游戏按钮数组
JButton exitButton,resetButton,newlyButton; //退出,重列,重新开始按钮
JLabel fractionLable=new JLabel("0"); //分数标签
JButton firstButton,secondButton; //分别记录两次被选中的按钮
int grid[][] = new int[8][7];//储存游戏按钮位置
static boolean pressInformation=false; //判断是否有按钮被选中
int x0=0,y0=0,x=0,y=0,fristMsg=0,secondMsg=0,validateLV; //游戏按钮的位置坐标
int i,j,k,n;//消除方法控制
public void init(){
mainFrame=new JFrame("JKJ连连看");
thisContainer = mainFrame.getContentPane();
thisContainer.setLayout(new BorderLayout());
centerPanel=new JPanel();
southPanel=new JPanel();
northPanel=new JPanel();
thisContainer.add(centerPanel,"Center");
thisContainer.add(southPanel,"South");
thisContainer.add(northPanel,"North");
centerPanel.setLayout(new GridLayout(6,5));
for(int cols = 0;cols 6;cols++){
for(int rows = 0;rows 5;rows++ ){
diamondsButton[cols][rows]=new JButton(String.valueOf(grid[cols+1][rows+1]));
diamondsButton[cols][rows].addActionListener(this);
centerPanel.add(diamondsButton[cols][rows]);
}
}
exitButton=new JButton("退出");
exitButton.addActionListener(this);
resetButton=new JButton("重列");
resetButton.addActionListener(this);
newlyButton=new JButton("再来一局");
newlyButton.addActionListener(this);
southPanel.add(exitButton);
southPanel.add(resetButton);
southPanel.add(newlyButton);
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())));
northPanel.add(fractionLable);
mainFrame.setBounds(280,100,500,450);
mainFrame.setVisible(true);
}
public void randomBuild() {
int randoms,cols,rows;
for(int twins=1;twins=15;twins++) {
randoms=(int)(Math.random()*25+1);
for(int alike=1;alike=2;alike++) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=randoms;
}
}
}
public void fraction(){
fractionLable.setText(String.valueOf(Integer.parseInt(fractionLable.getText())+100));
}
public void reload() {
int save[] = new int[30];
int n=0,cols,rows;
int grid[][]= new int[8][7];
for(int i=0;i=6;i++) {
for(int j=0;j=5;j++) {
if(this.grid[i][j]!=0) {
save[n]=this.grid[i][j];
n++;
}
}
}
n=n-1;
this.grid=grid;
while(n=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
while(grid[cols][rows]!=0) {
cols=(int)(Math.random()*6+1);
rows=(int)(Math.random()*5+1);
}
this.grid[cols][rows]=save[n];
n--;
}
mainFrame.setVisible(false);
pressInformation=false; //这里一定要将按钮点击信息归为初始
init();
for(int i = 0;i 6;i++){
for(int j = 0;j 5;j++ ){
if(grid[i+1][j+1]==0)
diamondsButton[i][j].setVisible(false);
}
}
}
public void estimateEven(int placeX,int placeY,JButton bz) {
if(pressInformation==false) {
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
pressInformation=true;
}
else {
x0=x;
y0=y;
fristMsg=secondMsg;
firstButton=secondButton;
x=placeX;
y=placeY;
secondMsg=grid[x][y];
secondButton=bz;
if(fristMsg==secondMsg secondButton!=firstButton){
xiao();
}
}
}
public void xiao() { //相同的情况下能不能消去。仔细分析,不一条条注释
if((x0==x (y0==y+1||y0==y-1)) || ((x0==x+1||x0==x-1)(y0==y))){ //判断是否相邻
remove();
}
else{
for (j=0;j7;j++ ) {
if (grid[x0][j]==0){ //判断第一个按钮同行哪个按钮为空
if (yj) { //如果第二个按钮的Y坐标大于空按钮的Y坐标说明第一按钮在第二按钮左边
for (i=y-1;i=j;i-- ){ //判断第二按钮左侧直到第一按钮中间有没有按钮
if (grid[x][i]!=0) {
k=0;
break;
}
else //K=1说明通过了第一次验证
}
if (k==1) {
linePassOne();
}
}
if (yj){ //如果第二个按钮的Y坐标小于空按钮的Y坐标说明第一按钮在第二按钮右边
for (i=y+1;i=j ;i++ ){ //判断第二按钮左侧直到第一按钮中间有没有按钮
if (grid[x][i]!=0){
k=0;
break;
}
else
}
if (k==1){
linePassOne();
}
}
if (y==j ) {
linePassOne();
}
}
if (k==2) {
if (x0==x) {
remove();
}
if (x0x) {
for (n=x0;n=x-1;n++ ) {
if (grid[n][j]!=0) {
k=0;
break;
}
if(grid[n][j]==0 n==x-1) {
remove();
}
}
}
if (x0x) {
for (n=x0;n=x+1 ;n-- ) {
if (grid[n][j]!=0) {
k=0;
break;
}
if(grid[n][j]==0 n==x+1) {
remove();
}
}
}
}
}
for (i=0;i8;i++ ) { //列
if (grid[i][y0]==0) {
if (xi) {
for (j=x-1;j=i ;j-- ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else
}
if (k==1) {
rowPassOne();
}
}
if (xi) {
for (j=x+1;j=i;j++ ) {
if (grid[j][y]!=0) {
k=0;
break;
}
else
}
if (k==1) {
rowPassOne();
}
}
if (x==i) {
rowPassOne();
}
}
if (k==2){
if (y0==y) {
remove();
}
if (y0y) {
for (n=y0;n=y-1 ;n++ ) {
if (grid[i][n]!=0) {
k=0;
break;
}
if(grid[i][n]==0 n==y-1) {
remove();
}
}
}
if (y0y) {
for (n=y0;n=y+1 ;n--) {
if (grid[i][n]!=0) {
k=0;
break;
}
if(grid[i][n]==0 n==y+1) {
remove();
}
}
}
}
}
}
}
public void linePassOne(){
if (y0j){ //第一按钮同行空按钮在左边
for (i=y0-1;i=j ;i-- ){ //判断第一按钮同左侧空按钮之间有没按钮
if (grid[x0][i]!=0) {
k=0;
break;
}
else //K=2说明通过了第二次验证
}
}
if (y0j){ //第一按钮同行空按钮在与第二按钮之间
for (i=y0+1;i=j ;i++){
if (grid[x0][i]!=0) {
k=0;
break;
}
else
}
}
}
public void rowPassOne(){
if (x0i) {
for (j=x0-1;j=i ;j-- ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else
}
}
if (x0i) {
for (j=x0+1;j=i ;j++ ) {
if (grid[j][y0]!=0) {
k=0;
break;
}
else
}
}
}
public void remove(){
firstButton.setVisible(false);
secondButton.setVisible(false);
fraction();
pressInformation=false;
k=0;
grid[x0][y0]=0;
grid[x][y]=0;
}
public void actionPerformed(ActionEvent e) {
if(e.getSource()==newlyButton){
int grid[][] = new int[8][7];
this.grid = grid;
randomBuild();
mainFrame.setVisible(false);
pressInformation=false;
init();
}
if(e.getSource()==exitButton)
System.exit(0);
if(e.getSource()==resetButton)
reload();
for(int cols = 0;cols 6;cols++){
for(int rows = 0;rows 5;rows++ ){
if(e.getSource()==diamondsButton[cols][rows])
estimateEven(cols+1,rows+1,diamondsButton[cols][rows]);
}
}
}
public static void main(String[] args) {
lianliankan llk = new lianliankan();
llk.randomBuild();
llk.init();
}
}
//old 998 lines
//new 318 lines
关于java源代码之家和java程序源代码的介绍到此就结束了,不知道你从中找到你需要的信息了吗 ?如果你还想了解更多这方面的信息,记得收藏关注本站。






