黑马程序员技术交流社区

标题: 关于JAVAEE就业班校招 [打印本页]

作者: feng_pump    时间: 2016-10-5 16:34
标题: 关于JAVAEE就业班校招
本人即将进入10月8日的JAVAEE就业班,就之前的机试和面试简单说两句
作者: feng_pump    时间: 2016-10-5 16:37
首先是机试,一般来说,是字符串类型和集合结合的一道,然后多线程一道,最后IO流和集合结合的一道题,只要不考的太偏就基本能满分通过,搞出来就行,不管你代码如何
作者: feng_pump    时间: 2016-10-5 16:41
1.6个评委打分,分数随机1-10分,去掉最高分,去掉最低分,输出最后的平均值
2.有关线程通信的,在控制台打印出12A34B56C78D....5152Z
3.创建一个方法,传入数据源文件夹,目标文件夹以及文件类型,将源文件夹中的该文件类型的文件复制到目标文件夹中,同时在控制台打印出复制过去的文件的名称

大致是这样的三道题
作者: feng_pump    时间: 2016-10-5 16:45
1.这题容易,一个random函数,六次取值放到集合中,然后Collections.sort排个序,去掉第一个和最后一个,再把剩下的遍历相加求平均数即可
2.这个题的话考到了线程通信,有点坑爹,因为当时老师说不考的,所以班上好多人没做出来,记住线程间通信的格式你就没问题
3.创建方法后,在方法中进行复制的动作,listfiles获取文件,然后遍历,判断一下复制过去就可以,再通过一个集合,把符合条件的文件类型名字(avi)放进去再遍历集合就ok
作者: feng_pump    时间: 2016-10-5 16:47
这是我的三道题代码,大家要是不会的看看,会的话可以指点指点{:2_32:}共同进步
1.public static void main(String[] args) {
                ArrayList<Integer> al = new ArrayList<>();
                Random r = new Random();
                System.out.println("评委打分分别为:");
                for(int i = 0 ; i < 6 ; i++){
                        int x = r.nextInt(10) + 1;
                        al.add(x);
                        System.out.print(x + "分  ");
                }
                System.out.println();
                Collections.sort(al);
                al.remove(0);
                al.remove(al.size() - 1);
                double sum = 0 ;
                for(Integer i : al){
                        sum = sum + i ;
                }
                double count = sum/al.size();
                System.out.println("该选手最终得分为:" + count + "分");
        }
2.package test;

public class Test2 {
        public static void main(String[] args) {
                final Jiaoti j = new Jiaoti();
                new Thread() {
                        public void run() {
                                for (int i = 0; i < 26; i++) {
                                        try {
                                                j.print1();
                                        } catch (InterruptedException e) {
                                                e.printStackTrace();
                                        }
                                }
                        }
                }.start();

                new Thread() {
                        public void run() {
                                for (int i = 0; i < 26; i++) {
                                        try {
                                                j.print2();
                                        } catch (InterruptedException e) {
                                                e.printStackTrace();
                                        }
                                }
                        }
                }.start();
        }
}

class Jiaoti {
        static int flag = 1;
        public static int num = 1;
        public static char ch = 'A';

        public void print1() throws InterruptedException {
                synchronized (this) {
                        if (flag != 1) {
                                this.wait();
                        }
                        for (int i = 0; i < 2; i++) {
                                System.out.print(num++);
                        }
                        flag = 2;
                        this.notify();
                }
        }

        public void print2() throws InterruptedException {
                synchronized (this) {
                        if (flag != 2) {
                                this.wait();
                        }
                        char c = (char) ch++;
                        System.out.print(c);

                        flag = 1;
                        this.notify();
                }
        }
}
3.public static void main(String[] args) throws IOException {
                String oldPath = "d:\\aaa";
                String newPath = "d:\\bbb";
                String fileFormat = "avi";
                Test3.copy(oldPath, newPath, fileFormat);
                ArrayList<String> al = new ArrayList<>();
                for(File f : new File(oldPath).listFiles()){
                        if(f.isFile() && f.getName().endsWith(fileFormat)){
                                al.add(f.getName());
                        }
                }
                for(String s : al){
                        System.out.println(s);
                }
        }
       
       
       
        public static void copy(String oldPath, String newPath, String fileFormat) throws IOException{
                File file = new File(oldPath);
                File[] fils = file.listFiles();
               
                for(File f: fils){
                        if(f.isFile() && f.getName().endsWith(fileFormat)){
                               
                                FileInputStream fis = new FileInputStream(f);
                                FileOutputStream fos = new FileOutputStream(new File(newPath, f.getName()));
                               
                                int len;
                                while((len = fis.read()) != -1){
                                        fos.write(len);
                                }
                               
                                fis.close();
                                fos.close();
                        }
                }
        }
       
作者: feng_pump    时间: 2016-10-5 17:04
么人么{:2_31:}
作者: miye    时间: 2016-10-7 00:00
,有,楼主继续,我在默默看

作者: 饭要大口吃    时间: 2016-10-7 00:04
指点指点 楼主~!~~~~~~~~~~~~~~~~
作者: wgc    时间: 2016-10-7 00:10
这么难啊,感觉进不了就业班了

作者: 干煸爪哇鱼    时间: 2016-10-7 10:07
。。。。。。。。。需要接受的知识很多啊,加油吧我
作者: 小泥人    时间: 2016-10-7 13:06
考试时间是多久,通过率大概是多少




欢迎光临 黑马程序员技术交流社区 (http://bbs.itheima.com/) 黑马程序员IT技术论坛 X3.2