Skip to content

Commit

Permalink
files of the lessons 23 and 24 is added
Browse files Browse the repository at this point in the history
  • Loading branch information
codershiyar committed Aug 26, 2022
1 parent c9cc594 commit 3343ff0
Show file tree
Hide file tree
Showing 3 changed files with 71 additions and 0 deletions.
20 changes: 20 additions & 0 deletions Lesson 23 - الدرس/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
public class App {
public static void main(String[] args) {
User user1 = new User();
System.out.println(user1.name);
User user2 = new User();
}
}


// Object-oriented programming in Java - برمجة كائنية التوجه
// -------------------------------------------------------------------------------------------------------------
// :الهدف منها
// يسهل بناء البرامج بشكل سريع في وقت قصير عبر إعادة الاستخدام امور اخرين مسبقا قاموا ببنائها
// OOP makes it easy to build programs quickly in a short time by reusing things that others have already built
// --------------------------------------------------------------------------------------------------------------
// Examples: امثلة
// --------------------------------------------------------------------------------------------------------------
// class فئة
// class object كائن/نسخة من كلاس المحدد
// constructor class بناء
9 changes: 9 additions & 0 deletions Lesson 23 - الدرس/User.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
public class User{
String name = "Coder Shiyar";

User(){
System.out.println("تم انشاء ابوجكت بنجاح");
}

}

42 changes: 42 additions & 0 deletions Lesson 24 - الدرس/App.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
import java.time.LocalTime;

class App {
public static void main(String[] args) {
System.out.println(LocalTime.now());

App2 app2 = new App2("Coder Shiyar");
}

}

class App2{
App2(String appName){
System.out.println("App name: "+appName);
}
App2(){

}
App2(String appName, double version){

}
}

// 1: Object Oriented Programming - exampels
//------------------------------------------
// 2: Classes in Java
// -----------------------------------------------------------------------------------------------------------------
// قوانين لإنشاء اسماء كلاسات في جافا هي نفس قوانين إنشاء اسماء متغيرات وملفات في جافا
// فقط اول حرف من اسم ينصح بان يكون حرف كبير
// The rules for creating class names in Java are the same as the rules for creating variable and file names in Java,
// only the first letter of a name is recommended to be a capital letter.
// -----------------------------------------------------------------------------------------------------------------
// في كل ملف جافا يمكنك انشاء بها كلاس او اكثر من كلاس
// بشرط ان يكون اسم احد كلاسات بنفس اسم ملف جافا الذي يتواجد بها ذلك كلاس
// In each Java file, one or more classes can be created
// Only the main class must have the same name as the java file in which the class is created.
// -----------------------------------------------------------------------------------------------------------------
// 3: Class Constructors in Java
// -----------------------------------------------------------------------------------------------------------------
// يمكن أن تحتوي كل فئة في جافا على كونستركتور واحد أو أكثر
// Every class in Java can have 1 or more constructors, but the constructor header must be different
// -----------------------------------------------------------------------------------------------------------------

0 comments on commit 3343ff0

Please sign in to comment.