#EC252
تعريف وفائدة الـ signature.
In Java, a signature refers to the unique identifier of a method or constructor. It consists of the method's name and the types of its parameters in the order in which they appear. The return type of the method is not part of its signature.
For example, consider the following method:
The signature of this method is "add(int, int)".
Java uses method signatures to determine which method to call when there are multiple methods with the same name in a class. This is known as method overloading. If two methods have the same name but different signatures, Java can determine which method to call based on the arguments passed to it.
تعريف وفائدة الـ signature.
In Java, a signature refers to the unique identifier of a method or constructor. It consists of the method's name and the types of its parameters in the order in which they appear. The return type of the method is not part of its signature.
For example, consider the following method:
public int add(int a, int b) {
return a + b;
}
The signature of this method is "add(int, int)".
Java uses method signatures to determine which method to call when there are multiple methods with the same name in a class. This is known as method overloading. If two methods have the same name but different signatures, Java can determine which method to call based on the arguments passed to it.
❤8
https://youtube.com/playlist?list=PL59LTecnGM1MMSBPiLN4aMwM7DcnVld0s
playlist فيها برامج تقدروا تدربوا عليها
#EC252
playlist فيها برامج تقدروا تدربوا عليها
#EC252
❤2👍1
#EC252
[Lecture 5]
the
https://www.javatpoint.com/understanding-toString()-method
[Lecture 5]
the
toString() method and how it's usedhttps://www.javatpoint.com/understanding-toString()-method
#EC252
[Lecture 5]
الفرق بين ميثود
nextDouble() و
nextGaussian()
https://stackoverflow.com/questions/34961054/whats-the-difference-between-nextgaussian-and-nextdouble-in-java-random-class
[Lecture 5]
الفرق بين ميثود
nextDouble() و
nextGaussian()
https://stackoverflow.com/questions/34961054/whats-the-difference-between-nextgaussian-and-nextdouble-in-java-random-class
#EC252
ملخص سلايد الدكتور
[Lecture 5]
• an object is always created from its class by calling the method (the constructor) that creates the object with the command
• a class has to define what methods and attributes the objects created from the class will have
• defining attributes within an object is done in quite a familiar fashion as normal variable
• writing the keyword private before attributes makes them hidden within the object and not show outside of it
• hiding things within an object is called encapsulation
• variables defined within a class are called object variables, object fields or object attributes.
• the 'state' of the object is determined by the values that have been set to its variables
• self-defined objects are created in the same way as ready-made objects, with the new command
• a constructor is a method used to instantiate and initialize objects
• it must have the same name as the class
• does not have a return type
• is invoked using the new operator
• if you don't create a constructor for your class, java will automatically create a default constructor
• a default constructor is a zero-argument constructor (takes no parameters), with an empty body, and can only be used to create objects from the class
• toString() : is a method that returns a string representation
• the System.out.println method requests the string representation of an object and then prints it, so..
System.out.println( objectName );
// same output as
System.out.println( objectName.toString );
• the "this" keyword
is a refrence to the object itself (another name for the object)
It's used before the dot operator "." to:
- reference instance data fields
- reference instance methods
- invoke a constructor
• String.format("%.2f, value);
returns a string where the value is rounded to contain 2 decimals
• when calling an object's method within the object, you can ditch the "this" keyword
• Random: is a ready-made class in java you can use to create objects that has the following methods:
.nextInt();
can be given an integer value as a parameter
returns a random integer within the range [0, parameter-1]
.nextDouble();
doesn't accept any parameters
returns the next pseudorandom, "uniformly" distributed double value between 0.0 and 1.0 from this random number generator's sequence
.nextGaussian();
doesn't accept any parameters
returns the next pseudorandom, Gaussian "normally" distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence
ملخص سلايد الدكتور
[Lecture 5]
• an object is always created from its class by calling the method (the constructor) that creates the object with the command
new• a class has to define what methods and attributes the objects created from the class will have
• defining attributes within an object is done in quite a familiar fashion as normal variable
• writing the keyword private before attributes makes them hidden within the object and not show outside of it
• hiding things within an object is called encapsulation
• variables defined within a class are called object variables, object fields or object attributes.
• the 'state' of the object is determined by the values that have been set to its variables
• self-defined objects are created in the same way as ready-made objects, with the new command
• a constructor is a method used to instantiate and initialize objects
• it must have the same name as the class
• does not have a return type
• is invoked using the new operator
• if you don't create a constructor for your class, java will automatically create a default constructor
• a default constructor is a zero-argument constructor (takes no parameters), with an empty body, and can only be used to create objects from the class
• toString() : is a method that returns a string representation
• the System.out.println method requests the string representation of an object and then prints it, so..
System.out.println( objectName );
// same output as
System.out.println( objectName.toString );
• the "this" keyword
is a refrence to the object itself (another name for the object)
It's used before the dot operator "." to:
- reference instance data fields
- reference instance methods
- invoke a constructor
• String.format("%.2f, value);
returns a string where the value is rounded to contain 2 decimals
• when calling an object's method within the object, you can ditch the "this" keyword
• Random: is a ready-made class in java you can use to create objects that has the following methods:
.nextInt();
can be given an integer value as a parameter
returns a random integer within the range [0, parameter-1]
.nextDouble();
doesn't accept any parameters
returns the next pseudorandom, "uniformly" distributed double value between 0.0 and 1.0 from this random number generator's sequence
.nextGaussian();
doesn't accept any parameters
returns the next pseudorandom, Gaussian "normally" distributed double value with mean 0.0 and standard deviation 1.0 from this random number generator's sequence
❤8
Forwarded from منهجي - MANHAJI
مواقع مهمة
1- أسئلة على أغلب المواضيع المقررة https://www.examveda.com/mcq-question-on-java-program/
2-*️⃣ 50 سؤال في الجافا
https://www.interviewbit.com/java-mcq/amp/
3- أسئلة متنوعة -ما بين السهل والمتوسط-
https://www.examtiger.com/mcq/java-programming-questions-answers/
4- موقع مهم
https://www.sanfoundry.com/java-mcqs-integer-floating-data-types/
5- flash card لأهم المفاهيم
https://quizlet.com/178995602/java-object-oriented-programming-final-exam-review-flash-cards/?funnelUUID=6358002d-e7bb-4153-89ca-0e79cd40e5e8
1- أسئلة على أغلب المواضيع المقررة https://www.examveda.com/mcq-question-on-java-program/
2-*️⃣ 50 سؤال في الجافا
https://www.interviewbit.com/java-mcq/amp/
3- أسئلة متنوعة -ما بين السهل والمتوسط-
https://www.examtiger.com/mcq/java-programming-questions-answers/
4- موقع مهم
https://www.sanfoundry.com/java-mcqs-integer-floating-data-types/
5- flash card لأهم المفاهيم
https://quizlet.com/178995602/java-object-oriented-programming-final-exam-review-flash-cards/?funnelUUID=6358002d-e7bb-4153-89ca-0e79cd40e5e8
Examveda
Java Program
MCQ Question and Answer
❤1
Java naming conventions:
Class names: Capitalize the first letter in each name (Pascal).
Variables and method names: Lowercase the first word, capitalize the first letter in all subsequent words (camelCase).
Constants: Capitalize all letters.
#EC252
Class names: Capitalize the first letter in each name (Pascal).
Variables and method names: Lowercase the first word, capitalize the first letter in all subsequent words (camelCase).
Constants: Capitalize all letters.
#EC252
❤4