java实训系统代码的简单介绍

这是我们的java实训内容,有没有大神知道其中的代码怎么打?知道几条也行,谢谢了! 2、 能新

2,3已经实现,其他的自己试着做一下不难

创新互联是一家集网站建设,六枝企业网站建设,六枝品牌网站建设,网站定制,六枝网站建设报价,网络营销,网络优化,六枝网站推广为一体的创新建站企业,帮助传统企业提升企业形象加强企业竞争力。可充分满足这一群体相比中小企业更为丰富、高端、多元的互联网需求。同时我们时刻保持专业、时尚、前沿,时刻以成就客户成长自我,坚持不断学习、思考、沉淀、净化自己,让我们为更多的企业打造出实用型网站。

package com.ui;

import java.io.File;

import java.io.FileInputStream;

import java.io.FileNotFoundException;

import java.io.FileOutputStream;

import java.io.IOException;

class NoteBook{

//创建文件

public File creatFile(String path,String name){

File tempPath=new File(path);

File tempFile=new File(path+File.separator+name+".txt");

if(!tempPath.exists()){

tempPath.mkdirs();

try {

tempFile.createNewFile();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}else{

try {

tempFile.createNewFile();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

return tempFile;

}

//写入文件

public void writeFile(File file,String content){

try {

FileOutputStream fos=new FileOutputStream(file);

fos.write(content.getBytes());

fos.close();

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

//读取文件

public String readFile(File file){

String str="";

try {

FileInputStream fis=new FileInputStream(file);

int datas;

while((datas=fis.read())!=-1){

str+=String.valueOf((char)datas);

}

} catch (FileNotFoundException e) {

// TODO Auto-generated catch block

e.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

return str;

}

//复制文件

public  void copyFile(File f1,File f2){

if(!f1.exists()){

System.out.println("目录"+f1.getName()+"不存在");

}else{

File[] files=f1.listFiles();

for(File f:files){

if(f.isDirectory()){

File temp=new File(f2,f.getName());

temp.mkdirs();

copyFile(f, temp);

}else{

File temp=new File(f2,f.getName());

try {

temp.createNewFile();

FileOutputStream fos=new FileOutputStream(temp);

FileInputStream fis=new FileInputStream(f);

int datas;

while((datas=fis.read())!=-1){

fos.write(datas);

}

fos.close();

fis.close();

} catch (FileNotFoundException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

}

}

//剪贴文件

public void cutFile(File f1,File f2){

int i=0;

if(!f1.exists()){

System.out.println("目录"+f1.getName()+"不存在");

}else{

i++;

File[] files=f1.listFiles();

for(File f:files){

if(f.isDirectory()){

File temp=new File(f2,f.getName());

temp.mkdirs();

cutFile(f, temp);

}else{

File temp=new File(f2,f.getName());

try {

temp.createNewFile();

FileOutputStream fos=new FileOutputStream(temp);

FileInputStream fis=new FileInputStream(f);

int datas;

while((datas=fis.read())!=-1){

fos.write(datas);

}

fis.close();

fos.close();

f.delete();

} catch (FileNotFoundException e1) {

// TODO Auto-generated catch block

e1.printStackTrace();

} catch (IOException e) {

// TODO Auto-generated catch block

e.printStackTrace();

}

}

}

}

f1.delete();

}

}

请高手帮忙解决一个JAVA实验程序!!

我把你的第一个给你贴上来吧,第二个应该也很简单,不过我懒得麻烦,而且你那个什么试验五我也不清楚,代码如下:

interface A{

public int method1(int x);

public int method2(int x,int y);

}

class B implements A{

public int method1(int x) {

// TODO Auto-generated method stub

int n = 1;

for(;x0;x--)

n=n*5;

return n;

}

public int method2(int x, int y) {

// TODO Auto-generated method stub

if(xy)

return y;

else return x;

}

}

public class test{

public static void main(String[] args){

B b=new B();

System.out.println(b.method1(2));

System.out.println(b.method2(2,8));

}

}

我全部都放到一起了,还有如果什么别的你不喜欢的地方,你自己改改,拿分走人。。。。

毕业实训啊,那位大哥给个学生学籍信息管理系统java源代码,感激不尽

百度一下,想飞社区,在资源里有,应该是在“JAVA开发-JAVA实例”分类下面。还有不少JAVA方面的案例源码,你可以参考一下。

分享文章:java实训系统代码的简单介绍
分享网址:https://www.cdcxhl.com/article48/dohhhep.html

成都网站建设公司_创新互联,为您提供移动网站建设域名注册营销型网站建设定制网站面包屑导航网站设计公司

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

成都网站建设