A. java中判断条件if的简单写法
写个方法 如:
static void fillParam(Criterion[], String param){
if(param != null){
//添加到Criterion[] 数组中
}
}
B. java 开启多线程里面如何加条件判断执行其他逻辑
package test; import java.util.concurrent.CountDownLatch;import java.util.concurrent.Executor;import java.util.concurrent.Executors; public class WatchThread { public void testThread() throws InterruptedException {int threadNum = 10;// 初始化countDownCountDownLatch threadSignal = new CountDownLatch(threadNum);// 创建固定长度的线程池Executor executor = Executors.newFixedThreadPool(threadNum);for (int i = 0; i < threadNum; i++) { // 开threadNum个线程Runnable task = new TestThread(threadSignal);// 执行executor.execute(task);}threadSignal.await(); // 等待所有子线程执行完// do workSystem.out.println(Thread.currentThread().getName() + "");} /*** 测试函数*/public static void main(String[] args) throws InterruptedException {WatchThread test = new WatchThread();test.testThread();} private class TestThread implements Runnable {private CountDownLatch threadsSignal; public TestThread(CountDownLatch threadsSignal) {this.threadsSignal = threadsSignal;} public void run() {System.out.println(Thread.currentThread().getName() + "开始...");// do shomethingSystem.out.println("开始了线程::::" + threadsSignal.getCount());// 线程结束时计数器减1threadsSignal.countDown();System.out.println(Thread.currentThread().getName() + "结束. 还有"+ threadsSignal.getCount() + " 个线程");}} }
C. java怎么用条件判断做员工实发工资
判断工资可以使用等等于和if进行判断。
员工工资组成一般由基本工资,绩效,出差补贴,通话补贴,房屋补贴以及餐补组成,Java中设置基本逻辑符号将以上工资和补贴进行计算,最后使用if语句或者等等于符号进行比较判断,员工人数过多时并且知道员工人数的情况下增加for循坏,减少工作量。