package com.test.forname;

public class TestForName {
public static void main(String[] args) throws Exception{

/* A a = (A) Class.forName("com.test.a.A").newInstance();
Class<?> c = Class.forName("com.test.c.C");
System.out.println(a.getClass());
System.out.println(c.getClasses());
System.out.println(c.getClassLoader());*/

int j = 0;
for(int i=0;i<100;i++){
j = j++;
}
System.out.print(j);

}

运行结果:0


package com.test.forname;

import com.test.a.A;
import com.test.c.C;

public class TestForName {
public static void main(String[] args) throws Exception{

/* A a = (A) Class.forName("com.test.a.A").newInstance();
Class<?> c = Class.forName("com.test.c.C");
System.out.println(a.getClass());
System.out.println(c.getClasses());
System.out.println(c.getClassLoader());*/

int j = 0;

j = j++  Java用了中间缓存变量的机制,等同于

temp = j;

j = j + 1;

j = temp;

for(int i=0;i<100;i++){

j = ++j;

}
System.out.println(j);

}

}

输出结果:100


int j = 0,k = 0;
for(int i=0;i<3;i++){
j = j++;

k = j++ + ++j;

if(i == 2){
System.out.println("j-"+j++);
}
}
System.out.println("j---"+j);
System.out.println("k---"+k);
}

输出结果:

j-6
j---7
k---10


for循环j = j++ 和 j = ++j的更多相关文章

  1. 今天遇到的面试题for(j=0,i=0;j<6,i<10;j++,i++) { k=i+j; } k 值最后是多少?

    for(j=0,i=0;j<6,i<10;j++,i++) { k=i+j; } k 值最后是多少? <script type="text/javascript" ...

  2. for(j=0,i=0;j

    for(j=0,i=0;j<6,i<10;j++,i++) { k=i+j; } k 值最后是多少? <script type="text/javascript" ...

  3. GCD - Extreme (II) for(i=1;i<N;i++) for(j=i+1;j<=N;j++) { G+=gcd(i,j); } 推导分析+欧拉函数

    /** 题目:GCD - Extreme (II) 链接:https://vjudge.net/contest/154246#problem/O 题意: for(i=1;i<N;i++) for ...

  4. 创建4个线程,两个对j加一,两个对j减一(j两同两内)

    package multithread; public class MyThread { //j变量私有 private int j; //同步的+1方法 private synchronized v ...

  5. python中数组切片[:,i] [i:j:k] [:-i] [i,j,:k]

    逗号","分隔各个维度,":"表示各个维度内的切片,只有:表示取这个维度的全部值,举例说明如下 1 1.二维数组 2 3 X[:,0]取所有行的第0个数据,第二 ...

  6. caffe,Inception v2 Check failed: top_shape[j] == bottom[i]->shape(j)

    使用Caffe 跑 Google 的Inception V2 对输入图片的shape有要求,某些shape输进去可能会报错. Inception model中有从conv和pooling层concat ...

  7. 列表中使用嵌套for循环[i*j for i in range(3) for j in range(3)]

    利用嵌套for循环形成一个新列表 [i*j for i in range(3) for j in range(3)]相当于如下代码 li=[] for i in range(3): for j in ...

  8. ZCMU训练赛-J(循环节+字符串处理)

    J - Java Beans There are N little kids sitting in a circle, each of them are carrying some java bean ...

  9. hdu 4049 2011北京赛区网络赛J 状压dp ***

    cl少用在for循环里 #include<cstdio> #include<iostream> #include<algorithm> #include<cs ...

随机推荐

  1. zstack 离线升级1.1到 1.2 rc

    说明 zstack版本1.1是通过离线安装的. 升级过程 1 挂载下一个版本的zstack的社区版本centos镜像 ZStack-Community-x86_64-DVD-1.2.0.iso mkd ...

  2. leetcode pow(x,n)实现

    题目描述: 自己实现pow(double x, int n)方法 实现思路: 考虑位运算.考虑n的二进制表示形式,以n=51(110011)为例,x^51 = x^1*x^2*x^16*x^32,因此 ...

  3. Design and Analysis of Algorithms_Decrease-and-Conquer

    I collect and make up this pseudocode from the book: <<Introduction to the Design and Analysis ...

  4. 下载VM12 虚拟机和安装kali

    为什么现在才写这个--  因为我在学校啊,学校的电脑还没有kali.好了我们开始. http://www.vmware.com/products/player/playerpro-evaluation ...

  5. 基础编程-java之股神

    买了一支股票,他知道从他买股票的那天开始,股票会有以下变化:第一天不变,以后涨一天,跌一天,涨两天,跌一天,涨三天,跌一天...依此类推. 为方便计算,假设每次涨和跌皆为1,股票初始单价也为1,请计算 ...

  6. UIDatePicker日期选取器

    //定义显示日期的格式 NSDateFormatter *dateFormat = [[NSDateFormatter alloc]init]; //NSDateFormatterMediumStyl ...

  7. iptables四个表与五个链间的处理关系

    转载自:http://www.linuxidc.com/Linux/2012-08/67505.htm netfilter/iptables IP 信息包过滤系统是一种功能强大的工具,可用于添加.编辑 ...

  8. 一个简单的c# 贪吃蛇程序

    一个简单的c#贪吃蛇程序 程序分为界面设计和程序设计:界面设计和程序设计均参考了一些游戏实例,但是所有代码内容是本人编写. 由于看到别人写的程序并没有署名,这里的署名全部都是csdn官网. 游戏界面设 ...

  9. VIM 常用快捷键

    一,光标移动 大家不要觉得光标移动不重要,其实它是基础,更好的光标移动,复制,粘贴,删除等才能更加的得心应手,进入了编辑器里面后,鼠标就不能用了. 光标移动 h 或 向左箭头键(←) 20h或者20( ...

  10. WebConfig错误页配置

    在system.web节下配置<customErrors mode="On" defaultRedirect="/ErrorPage/MyErrorPage.htm ...