周测试题及答案

1、实现在控制台输出九九乘法表。
package test1;

public class test1{
public static void main(String[] args) {
multiplication();
}
public static void multiplication(){
for (int i = 0; i <= 9; i++){
for(int j = 1; j <= i; j++){
System.out.print(i + "" + j + “=” + ij + " ");
}
System.out.println();
}
}
}
2、定义方法sum,要求实现两个数之和的运算,要求在main方法中调用。
package com.test;

public class test2 {
//定义相加的方法
public static int sum(int i,int j) {
return i + j;
}
public static void main(String[] args) {
int i = 10;
int j = 20;
System.out.println(i +"+"+j+"="+ test2.sum(i+j);
}
}
3、请写一个方法打印数组的内容,实现遍历数组,要求在main方法中调用。
public class Test3 {

public static void main(String[] args) {
	String[] arr1 = {"a","b","c"};
	String[] arr2 = {};
	String[] arr3 = null;
	System.out.println(printArray(arr1));
	System.out.println(printArray(arr2));
	System.out.println(printArray(arr3));
	
}

public static String printArray(String[] arr) {
	// [a,b,c]
	String result = "";
	
	if (null == arr) {
		result = "数组为null";
	} else {
		if (arr.length == 0) {
			result = "数组长度为 0";
		} else {
			result = "[";
			
			for (int i = 0; i < arr.length; i++) {
				if (i == arr.length - 1) {
					result += arr[i];
				} else {
					result += arr[i] + ",";
				}
			}
			
			result += "]";
		}
	}
	
	return result;
}

}
请将消费者在商城购物这个场景抽象出类,并编写一个客户端类,实现“小明在欧尚买了一件T恤”这样一个购物行为。
public class Customer {
private String name;

public Customer(String name) {
	super();
	this.name = name;
}

public String getName() {
	return name;
}

public void setName(String name) {
	this.name = name;
}

}

public class Market {
private String name;

public Market(String name) {
	super();
	this.name = name;
}

public String getName() {
	return name;
}

public void setName(String name) {
	this.name = name;
}

}

public class Product {
private String name;

public Product(String name) {
	super();
	this.name = name;
}

public String getName() {
	return name;
}

public void setName(String name) {
	this.name = name;
}

}

public interface ShoppingServiceInter {
void shopping(Customer cus, Market market, Product product);
}

public class ShoppingService implements ShoppingServiceInter {

public void shopping(Customer cus, Market market, Product product) {
	System.out.println("" + cus.getName() + "在" + market.getName() + "买了件" + product.getName() + "");
}

}

public class Client {
public static void main(String[] args) {
Customer customer = new Customer(“小明”);
Market market = new Market(“欧尚”);
Product product = new Product(“T恤”);

	ShoppingService service = new ShoppingService();
	service.shopping(customer, market, product);
}

}

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
车载软件是指对车载软件进行和验证的过程。以下是一些常见的车载件测试题及其答案: 1. 什么是车软件测试? 车载软件测试是指对车载软件进行验证和验证的过程,以确保其功能和性符合设计要求。 2. 车载件测试的目的是什么? 车载软件测试的目的是发现和修复潜在的缺陷和问题,确保车载软件的质量和可靠性,提供全和良好的用户体验。 3 车载软件测试的常见方法有哪些? 常见的车载软件测试方法包括功能测试、性能测试、兼容性测试、安全性测试、可靠性测试等。 4. 车载软件测试中的功能测试包括哪些内容? 功能测试主要验证车载软件的各项功能是否按照设计要求正常工作,包括界面操作、数据输入输出、功能逻辑等方面的测试。 5. 车载软件测试中的性能测试包括哪些内容? 性能测试主要验证车载软件在各种负载条件下的性能表现,包括响应时间、处理能力、资源占用等方面的测试。 6. 车载软件测试中的兼容性测试包括哪些内容? 兼容性测试主要验证车载软件在不同硬件平台、操作系统版本、外部设备等方面的兼容性,确保软件能够正常运行和与其他系统进行交互。 7. 车载软件测试中的安全性测试包括哪些内容? 安全性测试主要验证车载软件在防止未授权访问、数据保护、通信安全等方面的安全性能,确保软件在使用过程中不会存在安全隐患。 8. 车载软件测试中的可靠性测试包括哪些内容? 可靠性测试主要验证车载软件在长时间运行、异常情况处理、故障恢复等方面的可靠性,确保软件能够稳定可靠地工作。

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值