وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای - تأسیس شده در سال 1396
وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای

وبلاگ رسمی علیرضا شهامت در بلاگ اسکای - تأسیس شده در سال 1396

جاوا - تفاوت بین x++ و ++x - با مقدار یا با مرجع

package com.company;

public class Main {

public static void main(String[] args) {
// write your code here
int original = 10;

System.out.println("Original before: " + original);

incrementValue(original);

System.out.println("Original after: " + original);


}

static void incrementValue(int inMethod) {
inMethod++;
System.out.println("In method (section 1): " + inMethod);

System.out.println("In method (section 2): " + ++inMethod);

System.out.println("In method (section 3): " + inMethod++);

++inMethod;
System.out.println("In method (section 4): " + inMethod);

System.out.println("In method (section 5): " + inMethod++);

System.out.println("In method (section 6): " + ++inMethod);
}


}
نظرات 0 + ارسال نظر
برای نمایش آواتار خود در این وبلاگ در سایت Gravatar.com ثبت نام کنید. (راهنما)
ایمیل شما بعد از ثبت نمایش داده نخواهد شد