1 package com.pingfan.array; 2 3 import java.util.Arrays; 4 5 public class ArrayDemo6 { 6 public static void main(String[] args) { 7 int[] a = {1,2,3, ...
分类:
其他好文 时间:
2021-04-30 12:43:27
阅读次数:
0
类中多个Synchronized方法 下面给出一个例子,说明一个class中有两个方法synchronized的情况。它们互相阻挡的用法和上面的“一个方法有synchronized”的情况是一样的。例1.9.5:class A { public synchronized void f1() { fo ...
分类:
编程语言 时间:
2021-04-30 12:36:54
阅读次数:
0
1 package com.pingfan.array; 2 3 public class ArrayDemo2 { 4 public static void main(String[] args) { 5 //静态初始化:创建 + 赋值 6 int[] a ={1,2,3,4,5,6,7,8}; ...
分类:
其他好文 时间:
2021-04-30 12:34:23
阅读次数:
0
委派模式 委派模式结构图: 示例代码: // 抽象任务类 public interface Task { void doTask(); } // 具体任务角色A public class ConcreteTaskA implements Task{ @Override public void doT ...
分类:
其他好文 时间:
2021-04-30 12:30:39
阅读次数:
0
在paintEvent事件中绘制窗口边框这里我们需要重写paintEvent方法,具体代码如下: void paintEvent(QPaintEvent *event) { QPainter painter(this); painter.setRenderHint(QPainter::Antiali ...
分类:
其他好文 时间:
2021-04-30 12:29:47
阅读次数:
0
#include<stdio.h> void fun(int n); int main(){ int n; long long f; while(scanf("%d", &n)!=EOF){ fun(n); } return 0; } void fun(int n){ int f[505],a[50 ...
分类:
其他好文 时间:
2021-04-30 12:29:16
阅读次数:
0
1,计算0到100之间奇数和偶数的和 public static void main(String[] args) { //练习,计算0到100之间的奇数和偶数的和 int oddsum=0;//奇数 int evensum=0;//偶数 for(int i=0;i<=100;i++){ if(i% ...
分类:
其他好文 时间:
2021-04-30 12:27:04
阅读次数:
0
```javapublic class oopDemo6Student { String name; int age; public void study(){ System.out.println(this.name+"在学习"); }}//person >名字、生日、身高、体重//类(抽象) > ...
分类:
其他好文 时间:
2021-04-30 12:16:19
阅读次数:
0
public class oopDemoStufent2 { //static是一个静态方法 public static void say1(){ System.out.println("学生说好"); }} public class oopDemoStudent { //没有static就是非静态 ...
分类:
其他好文 时间:
2021-04-30 12:15:30
阅读次数:
0
一、循环嵌套 1. 下列代码的运行结果是( ) public static void main(String[] args){ int count = 0; for(int j = 0;j<3;j++) { for(int i = 0;i<6;i++) { count++; } } System.o ...
分类:
编程语言 时间:
2021-04-30 12:15:08
阅读次数:
0