java實(shí)訓(xùn)系統(tǒng)代碼的簡(jiǎn)單介紹

這是我們的java實(shí)訓(xùn)內(nèi)容,有沒(méi)有大神知道其中的代碼怎么打?知道幾條也行,謝謝了! 2、?能新

2,3已經(jīng)實(shí)現(xiàn),其他的自己試著做一下不難

創(chuàng)新互聯(lián)是一家集網(wǎng)站建設(shè),六枝企業(yè)網(wǎng)站建設(shè),六枝品牌網(wǎng)站建設(shè),網(wǎng)站定制,六枝網(wǎng)站建設(shè)報(bào)價(jià),網(wǎng)絡(luò)營(yíng)銷,網(wǎng)絡(luò)優(yōu)化,六枝網(wǎng)站推廣為一體的創(chuàng)新建站企業(yè),幫助傳統(tǒng)企業(yè)提升企業(yè)形象加強(qiáng)企業(yè)競(jìng)爭(zhēng)力??沙浞譂M足這一群體相比中小企業(yè)更為豐富、高端、多元的互聯(lián)網(wǎng)需求。同時(shí)我們時(shí)刻保持專業(yè)、時(shí)尚、前沿,時(shí)刻以成就客戶成長(zhǎng)自我,堅(jiān)持不斷學(xué)習(xí)、思考、沉淀、凈化自己,讓我們?yōu)楦嗟钠髽I(yè)打造出實(shí)用型網(wǎng)站。

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{

//創(chuàng)建文件

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;

}

//復(fù)制文件

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();

}

}

請(qǐng)高手幫忙解決一個(gè)JAVA實(shí)驗(yàn)程序!!

我把你的第一個(gè)給你貼上來(lái)吧,第二個(gè)應(yīng)該也很簡(jiǎn)單,不過(guò)我懶得麻煩,而且你那個(gè)什么試驗(yàn)五我也不清楚,代碼如下:

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));

}

}

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

畢業(yè)實(shí)訓(xùn)啊,那位大哥給個(gè)學(xué)生學(xué)籍信息管理系統(tǒng)java源代碼,感激不盡

百度一下,想飛社區(qū),在資源里有,應(yīng)該是在“JAVA開(kāi)發(fā)-JAVA實(shí)例”分類下面。還有不少JAVA方面的案例源碼,你可以參考一下。

分享文章:java實(shí)訓(xùn)系統(tǒng)代碼的簡(jiǎn)單介紹
分享網(wǎng)址:http://www.bm7419.com/article48/dohhhep.html

成都網(wǎng)站建設(shè)公司_創(chuàng)新互聯(lián),為您提供移動(dòng)網(wǎng)站建設(shè)域名注冊(cè)、營(yíng)銷型網(wǎng)站建設(shè)、定制網(wǎng)站面包屑導(dǎo)航、網(wǎng)站設(shè)計(jì)公司

廣告

聲明:本網(wǎng)站發(fā)布的內(nèi)容(圖片、視頻和文字)以用戶投稿、用戶轉(zhuǎn)載內(nèi)容為主,如果涉及侵權(quán)請(qǐng)盡快告知,我們將會(huì)在第一時(shí)間刪除。文章觀點(diǎn)不代表本網(wǎng)站立場(chǎng),如需處理請(qǐng)聯(lián)系客服。電話:028-86922220;郵箱:631063699@qq.com。內(nèi)容未經(jīng)允許不得轉(zhuǎn)載,或轉(zhuǎn)載時(shí)需注明來(lái)源: 創(chuàng)新互聯(lián)

成都網(wǎng)站建設(shè)