编程语言的简易小问题

1、JavaScript是解释型语言吗?

2、这道题的打印是?

package com.m;


public class Test {
    public int test(int a,int b){
        return a - b;
    }

    public static void main(String[] args) {
        Test1 test1 = new Test1();
        Test test = new Test1();
        System.out.println(test.test(50,100));	//打印?
        System.out.println(test1.test(50,100));	//打印?
    }
}

class Test1 extends Test{
    public int test(int a,int b){
        return a+b;
    }
}

 

JavaScript是解释型语言

第二题 -50

package com.m;
 
 
public class Test {
    public int test(int a,int b){
        return a - b;
    }
 
    public static void main(String[] args) {
        Test1 test1 = new Test1();
        Test test = new Test1();
        System.out.println(test.test(50,100));	//打印 a-b   输出 -50
        System.out.println(test1.test(50,100));	//打印 a+b   输出 150
    }
}
 
class Test1 extends Test{
    public int test(int a,int b){
        return a+b;
    }
}

 

1.JavaScript(通常缩写为JS)是一种高级的、解释型的编程语言

JavaScript一种直译式脚本语言,是一种动态类型、弱类型、基于原型的语言

2.两个都输出150

第一个Test1 test1 = new Test1()调用方法调用自己的 所以是a+b

第二个Test test = new Test1() 父类new 子类实际上调用的还是子类的方法。只是部分不能调用 所以还是a+b