قناة هندسة الحاسب
835 subscribers
2.29K photos
38 videos
969 files
321 links
1. القناة مخصصة للدراسة ولمقررات القسم وأخباره، يمنع نشر غير ما يتعلق بهذا إلا في حالات استثنائية.

2. يجب استعمال الهاشتاقات لكل مقرر يراد نشر شيء يخصه، وهاشتاق #إعلان للإعلانات.
Download Telegram
#Ec251
للي عندهم مشاكل مع الـflowcharts هادو مفروض يخلوك تتمكن منها 🤍:

1️⃣
شرح للأساس ( بالعربي )
https://youtu.be/hjsXyzBU-og

2️⃣
( بالعربي )
https://youtu.be/wvwAVS4yIeI

3️⃣
* للناس الي تحب المحتوى الانجليزي زيني 🤝🏻😄*
https://youtu.be/SWRDqTx8d4k
8
#ec381 first midterm
6
MidtermFall22.pdf
444.4 KB
امتحان الجافا النصفي السيم الماضي #EC252
#EC252

[Lecture 3]

• variables defined within a method (beside the parameters) are called helper variables.

• String methods:

.charAt();
return type: char.
function: returns the character at the specified index.

last character of a word:
word.charAt(word.length()-1);

.equals();
return type: boolean.
function: compares two strings. returns true if the strings are equal, and false if not.

.indexOf();
return type: int.
function: returns the position of the first found occurrence of specified characters in a string.
(when not found returns -1)

.length();
return type: int.
function: returns the length of a specified string.

.substring();
return type: String.
function: returns a new string which is the substring of a specified string.

when given one parameter:
substring ( index )
returns:
from index → end of original string.

when given two parameters:
returns:
string [index, index)

• Scanner methods:

.next();
reads a string from the keyboard up to the first encountered space.

.nextLine();
reads up to the a line break.

.nextInt();
reads an integer from the keyboard

• Object: something that has methods and a value.

• Integers (variables of type int) have no methods therefore are not objects.

• objects must be created with the new command, strings make an exception to this rule, using the new command when creating a String object is uncommon.

• Class: an object's type.

• Arraylists are the most used object-containers in java.

• Arraylists can be used to store unlimited number of objects.

• creating an arraylist from an array:
String[] array;
ArrayList<string> list = new ArrayList<>(Arrays.asList(array);

• creating an array from an arraylist:
String[] array1 = new String [list.size()];
list.toArray(array1);

• static max and min in the java.util.Collections class return the maximum and minimum element in an arraylist.

java.util.Collections.max(list)
java.util.Collections.min(list)

• we can use a for-each loop to go through the items of an ArrayList.

• ordering a string type arraylist by size means putting it in alphabetical order.

• ordering, reversing and shuffling an arraylist:
Collections.sort(arraylist);
Collections.reverse(arraylist);
Collections.shuffle(arraylist);

• an integer type arraylist is defined as ArrayList<Integer>

• when dealing with integer type arraylists,
arraylist.remove(4);
// removes number with index 4
arraylist.remove(Integer.valueOf(4));
// removes number 4 from arraylist

• truth values (boolean type variables)
if (boolean)
// is the same as boolean==true
if (!boolean)
// is the same as boolean==false
12👏2