مثال بسيط ع الكلاس والاوبجكت ف جافا:
مثلاً مطلوب منك تسوي برنامج لسيارات تويوتا، الشاص والجيب ووو
ف انت مايحتاج تسوي لكل موديل كلاس لحاله
بدلا من كذا، حتسوي كلاس فيه مواصفات السيارات
مثلاً
كلاس يحوي، الموديل وسنة الانتاج، وعدد الكراسي، وكم ماشية، ووارد ايش ووالخ..
وتسوي من هالكلاس عدة كائنات وكل كائن حيكون قادر ياخذ كل مواصفات الكلاس اللي فوق
وفقط هنا انت بتحتاج تضيف القيم له
وبيوضح معانا ف الامثله الجايه ان شاء الله 👌
مثلاً مطلوب منك تسوي برنامج لسيارات تويوتا، الشاص والجيب ووو
ف انت مايحتاج تسوي لكل موديل كلاس لحاله
بدلا من كذا، حتسوي كلاس فيه مواصفات السيارات
مثلاً
كلاس يحوي، الموديل وسنة الانتاج، وعدد الكراسي، وكم ماشية، ووارد ايش ووالخ..
وتسوي من هالكلاس عدة كائنات وكل كائن حيكون قادر ياخذ كل مواصفات الكلاس اللي فوق
وفقط هنا انت بتحتاج تضيف القيم له
وبيوضح معانا ف الامثله الجايه ان شاء الله 👌
❤2
قريباً ان شاء الله رح انزل لكم تمارين محلوله بالجافا، السؤال بعدين الاجابه علشان تقدر من خلالها تختبر نفسك :)
اي استفسار كلمني: @Yrrrr
>
اي استفسار كلمني: @Yrrrr
>
👍1
السؤال الاول:
Write a Java program to print 'Hello' on screen and then print your name on a separate line.
Write a Java program to print 'Hello' on screen and then print your name on a separate line.
حله وقارن حلك مع الحل ذا:
public class Exercise1 {
public static void main(String[] args) {
System.out.println("Hello\nFawaz Saleh!");
}
}👍2❤1
السؤال الثاني:
Write a Java program to print the sum of two numbers.
Write a Java program to print the sum of two numbers.
❤2
الحل:
public class Exercise2 {
public static void main(String[] args) {
System.out.println(24+26);
}
}
public static void main(String[] args) {
System.out.println(24+26);
}
}
👍3
السؤال الثالث:
Write a Java program to divide two numbers and print on the screen.
Write a Java program to divide two numbers and print on the screen.
الحل:
public class Exercise3 {
public static void main(String[] args) {
System.out.println(50/3);
}
}
public static void main(String[] args) {
System.out.println(50/3);
}
}
👍5❤3
4. Write a Java program to print the result of the following operations:
a. -5 + 8 * 6
b. (55+9) % 9
c. 20 + -3*5 / 8
d. 5 + 15 / 3 * 2 - 8 % 3
Expected Output :
43
1
19
13
.
a. -5 + 8 * 6
b. (55+9) % 9
c. 20 + -3*5 / 8
d. 5 + 15 / 3 * 2 - 8 % 3
Expected Output :
43
1
19
13
.
❤1
الحل:
public class Exercise3 {
public static void main(String[] args) {
System.out.println(-5 + 8 * 6);
System.out.println((55+9) % 9);
System.out.println(20 + -3*5 / 8);
System.out.println(5 + 15 / 3 * 2 - 8 % 3);
}
}👍3
5. Write a Java program that takes two numbers as input and display the product of two numbers:
Input first number: 25
Input second number: 5
Expected Output :
25 x 5 = 125
.
Input first number: 25
Input second number: 5
Expected Output :
25 x 5 = 125
.
الحل:
import java.util.Scanner;
public class Exercise5 {
public static void main(String[] args) {
Scanner in = new Scanner(System.in);
System.out.print("Input first number: ");
int num1 = in.nextInt();
System.out.print("Input second number: ");
int num2 = in.nextInt();
System.out.println(num1 + " x " + num2 + " = " + num1 * num2);
}
}
👍2
تم افتتاح قروب المناقشه وتبادل الخبرات بلغة الجافا
رابط القروب:
https://t.me/+PiwfgXwhzWE2ZTI0
https://t.me/+PiwfgXwhzWE2ZTI0
https://t.me/+PiwfgXwhzWE2ZTI0
..
حياكم
رابط القروب:
https://t.me/+PiwfgXwhzWE2ZTI0
https://t.me/+PiwfgXwhzWE2ZTI0
https://t.me/+PiwfgXwhzWE2ZTI0
..
حياكم
👍3
What is the size of float and double in java?
Anonymous Quiz
71%
32 and 64
15%
32 and 32
14%
64 and 32