A股上市公司传智教育(股票代码 003032)旗下技术交流社区北京昌平校区

 找回密码
 加入黑马

QQ登录

只需一步,快速开始

© feng_pump 中级黑马   /  2016-10-5 16:34  /  1350 人查看  /  10 人回复  /   1 人收藏 转载请遵从CC协议 禁止商业使用本文

本人即将进入10月8日的JAVAEE就业班,就之前的机试和面试简单说两句

10 个回复

倒序浏览
首先是机试,一般来说,是字符串类型和集合结合的一道,然后多线程一道,最后IO流和集合结合的一道题,只要不考的太偏就基本能满分通过,搞出来就行,不管你代码如何
回复 使用道具 举报
1.6个评委打分,分数随机1-10分,去掉最高分,去掉最低分,输出最后的平均值
2.有关线程通信的,在控制台打印出12A34B56C78D....5152Z
3.创建一个方法,传入数据源文件夹,目标文件夹以及文件类型,将源文件夹中的该文件类型的文件复制到目标文件夹中,同时在控制台打印出复制过去的文件的名称

大致是这样的三道题
回复 使用道具 举报
1.这题容易,一个random函数,六次取值放到集合中,然后Collections.sort排个序,去掉第一个和最后一个,再把剩下的遍历相加求平均数即可
2.这个题的话考到了线程通信,有点坑爹,因为当时老师说不考的,所以班上好多人没做出来,记住线程间通信的格式你就没问题
3.创建方法后,在方法中进行复制的动作,listfiles获取文件,然后遍历,判断一下复制过去就可以,再通过一个集合,把符合条件的文件类型名字(avi)放进去再遍历集合就ok
回复 使用道具 举报
这是我的三道题代码,大家要是不会的看看,会的话可以指点指点{: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();
                        }
                }
        }
       
回复 使用道具 举报
么人么{:2_31:}
回复 使用道具 举报
miye 初级黑马 2016-10-7 00:00:14
7#
,有,楼主继续,我在默默看
来自宇宙超级黑马专属苹果客户端来自宇宙超级黑马专属苹果客户端
回复 使用道具 举报
指点指点 楼主~!~~~~~~~~~~~~~~~~
回复 使用道具 举报
wgc 中级黑马 2016-10-7 00:10:33
9#
这么难啊,感觉进不了就业班了
来自宇宙超级黑马专属苹果客户端来自宇宙超级黑马专属苹果客户端
回复 使用道具 举报
。。。。。。。。。需要接受的知识很多啊,加油吧我
回复 使用道具 举报
考试时间是多久,通过率大概是多少
回复 使用道具 举报
您需要登录后才可以回帖 登录 | 加入黑马