Skip to content

Commit

Permalink
java jupyter-notebook ders notları eklendi
Browse files Browse the repository at this point in the history
  • Loading branch information
kursatsmsek committed Feb 11, 2023
1 parent c78e13c commit 326be15
Show file tree
Hide file tree
Showing 33 changed files with 11,288 additions and 0 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,380 @@
{
"cells": [
{
"cell_type": "markdown",
"metadata": {},
"source": [
"# ARRAYLER-ARRAYLISTLER-STRING SINIFI VE LINKEDLISTLER"
]
},
{
"cell_type": "code",
"execution_count": 2,
"metadata": {},
"outputs": [],
"source": [
"int[] array = new int[10]; // İçine 10 tane int değer alabilecek \"array\" adında bir array oluşturduk."
]
},
{
"cell_type": "code",
"execution_count": 4,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"4"
]
},
"execution_count": 4,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"array[0] = 4; //arrayin 0.indeksine 4 değerini atadık."
]
},
{
"cell_type": "code",
"execution_count": 5,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Arrayin 0. indeksi: 4\r\n"
]
}
],
"source": [
"System.out.println(\"Arrayin 0. indeksi: \" + array[0]);"
]
},
{
"cell_type": "code",
"execution_count": 10,
"metadata": {},
"outputs": [],
"source": [
"int[] brray = {51,52,53,54,55}; //\"brray\" isminde array oluşturduk ve değerleri içinde direk atamış olduk."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"indeks: 0 değer: 51\n",
"indeks: 1 değer: 52\n",
"indeks: 2 değer: 53\n",
"indeks: 3 değer: 54\n",
"indeks: 4 değer: 55\n"
]
}
],
"source": [
"for (int i = 0; i < brray.length ; i++) {\n",
"System.out.println(\"indeks: \" + i + \" değer: \" + brray[i]);\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### ARRAY SIRALAMA"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {
"scrolled": true
},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\n",
"2\n",
"36\n",
"58\n",
"59\n",
"112\n"
]
}
],
"source": [
"int[] sirasiz = {1,58,2,59,36,112}; //Sırasız array oluşturduk.\n",
"Arrays.sort(sirasiz); // Sıraladık.\n",
"for (int i : sirasiz) {\n",
" System.out.println(i);\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### ARRAY EŞİTLİĞİ DENEME"
]
},
{
"cell_type": "code",
"execution_count": 1,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Eşit\r\n"
]
}
],
"source": [
"int[] birinci = {1,2,3};\n",
"int[] ikinci = {1,2,3};\n",
"if (Arrays.equals(birinci,ikinci)) {\n",
"System.out.println(\"Eşit\");\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### ÇOK BOYUTLU ARRAYLER"
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"10 20 \n",
"30 40 \n"
]
}
],
"source": [
"int[][] crray = new int[2][2]; // 2'ye 2'lik bir çok boyutlu array oluşturduk.\n",
"crray[0][0] = 10;\n",
"crray[0][1] = 20; // Arrayimizin 0.indeksli satırının (1.satır) 1.indeksine (2.sütununa) 20 değerini atadık.\n",
"crray[1][0] = 30;\n",
"crray[1][1] = 40;\n",
"for (int i = 0; i < 2 ; i++) {\n",
" for(int j = 0; j < 2; j++) {\n",
" System.out.print(crray[i][j] + \" \");\n",
" }\n",
" System.out.println(\"\");\n",
"}"
]
},
{
"cell_type": "markdown",
"metadata": {},
"source": [
"### ARRAYLISTLER"
]
},
{
"cell_type": "code",
"execution_count": 15,
"metadata": {},
"outputs": [],
"source": [
"import java.util.ArrayList;\n",
"ArrayList<String> liste = new ArrayList<String>(); //ArrayList oluşturduk."
]
},
{
"cell_type": "code",
"execution_count": 16,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 16,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"liste.add(\"Kemal\");\n",
"liste.add(\"Asım\");\n",
"liste.add(\"Kürşat\"); //Listeye değer ekledik."
]
},
{
"cell_type": "code",
"execution_count": 17,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Kemal\n",
"Asım\n",
"Kürşat\n"
]
}
],
"source": [
"for (int i = 0; i < liste.size() ; i++) {\n",
"System.out.println(liste.get(i));\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 18,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"true"
]
},
"execution_count": 18,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"liste.remove(\"Kemal\"); // Değer kaldırdık."
]
},
{
"cell_type": "code",
"execution_count": 19,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Asım\n",
"Kürşat\n"
]
}
],
"source": [
"for (int i = 0; i < liste.size() ; i++) {\n",
"System.out.println(liste.get(i));\n",
"}"
]
},
{
"cell_type": "code",
"execution_count": 21,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"1\r\n"
]
}
],
"source": [
"System.out.println(liste.indexOf(\"Kürşat\")); //Kürşatın indeksini verir."
]
},
{
"cell_type": "code",
"execution_count": 22,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"-1\r\n"
]
}
],
"source": [
"System.out.println(liste.indexOf(\"Kemal\")); // Değer yoksa -1 verir."
]
},
{
"cell_type": "code",
"execution_count": 23,
"metadata": {},
"outputs": [
{
"data": {
"text/plain": [
"Asım"
]
},
"execution_count": 23,
"metadata": {},
"output_type": "execute_result"
}
],
"source": [
"liste.set(0,\"Kadir\"); //0.indeksi Kadir yapar. "
]
},
{
"cell_type": "code",
"execution_count": 24,
"metadata": {},
"outputs": [
{
"name": "stdout",
"output_type": "stream",
"text": [
"Kadir\n",
"Kürşat\n"
]
}
],
"source": [
"for (int i = 0; i < liste.size() ; i++) {\n",
"System.out.println(liste.get(i));\n",
"}"
]
}
],
"metadata": {
"kernelspec": {
"display_name": "Java",
"language": "java",
"name": "java"
},
"language_info": {
"codemirror_mode": "java",
"file_extension": ".jshell",
"mimetype": "text/x-java-source",
"name": "Java",
"pygments_lexer": "java",
"version": "14.0.2+12-46"
}
},
"nbformat": 4,
"nbformat_minor": 4
}
Loading

0 comments on commit 326be15

Please sign in to comment.