26/06/2022

Java toplu text

Buraya kadar ki (OOP) başına kadr ki textler

		
		/*
		//PRINTF
		double DD = -15000.256;
		//System.out.printf("Burasi %d string \n",123456);
		//System.out.printf("Burasi %20d string ",123456);
		System.out.printf("Buras %f string \n",DD);
		System.out.printf("Buras %,020.2f string ",DD);
	}
		*/
		
		/*
		//FOR EACH
		//we can do it with an array as below
		//String[] animals = {"kedi", "kopek", "balik", "kus"};
		//we can do it with an ArrayList
		ArrayList<String> animals= new ArrayList<String>();
		animals.add("kedi");
		animals.add("kopek");
		animals.add("balik");
		animals.add("kus");
		
		//for String i in animals
		for (String i: animals) {
			System.out.println(i);
		}
		
	}
		
		*/
		
		/*
		// 2D ARRAYLISTS
		 * 
		//we declare a ArrayList of ArrayList<string>
		ArrayList<ArrayList<String>> groceryList = new ArrayList();
		
		
		ArrayList<String> bakeryList = new ArrayList();
		bakeryList.add("donut");
		bakeryList.add("garlic");
		bakeryList.add("sogan");
		
		ArrayList<String> produceList = new ArrayList();
		produceList.add("tomatoes");
		produceList.add("meat");
		produceList.add("paprika");
		
		ArrayList<String> drinksList = new ArrayList();
		drinksList.add("soda");
		drinksList.add("cole");
		
		//add the arraylists to the Arraylist of arraylists
		groceryList.add(bakeryList);
		groceryList.add(produceList);
		groceryList.add(drinksList);
		
		System.out.println(groceryList.get(0).get(0));
	}
		*/
		
		/*
		//additional way pre declarion of array
		String[] cars = new String[4];
		cars[0] = "Camaro";
		cars[1] = "covertte";
		cars[2] = "tesla";
		cars[3] = "bmw";
		
		for (int i=0;i <cars.length; i++)
		{
			System.out.println(cars[i]);
		}
		*/
	/*	
		
		// Array
		
		String[] cars = {"camaro","corvette","tesla"};
		cars[0] = "mustange";
		System.out.println(cars[0]);
		
	}	*/	
		/*
		while(name.isBlank())
		{
			System.out.println("enter your name");
			name = scanner.nextLine();
		}
		*/
		/*
		do {
			System.out.println("enter your name");
			name = scanner.nextLine();
		}while(name.isBlank());
		
		System.out.println("Hello "+name);
		
	}
		*/
		
		/*
		Scanner s=new Scanner(System.in);
		System.out.println("playing a game enter q or Q to quit");
		String response=s.next();
		if (response.equals("q") || response.equals("Q")) {
			System.out.println("you quitted");
		}
		else {
			System.out.println("you still play");
		
		}
		*/
	}

		/* 
		String day = "tty";
		
		switch (day) {
		
		case "Sunday": System.out.println("It is Sunday");
		break;
	    case "Monday": System.out.println("It is Monday");
	    break;
		case "Tuesday": System.out.println("It is Tuesday");
		break;
		case "Wednesday": System.out.println("It is Wednesday");
		break;
		case "Thursday": System.out.println("It is Thursday");
		break;
		case "Friday": System.out.println("It is Friday");
		break;
		default: System.out.println("That is not a day");
		}
	}
*/	
		/*int age = 12;

		if (age>=18)
		{
			System.out.println("adult");
		}
		else if (age >= 75) {
			System.out.println("boomer");
		}
		else {
			System.out.println("not adlt");
		}
		*/
		
		/*Random random = new Random();
		int x= random.nextInt(6)+1;
		System.out.println("here is x: "+x);
		*/
		
		// TODO Auto-generated method stub
		/*
		 * Scanner scanner = new Scanner(System.in);
		 
		System.out.println("I miss home\n");
		System.out.print("whats it");
		String name = scanner.nextLine();
		System.out.println("name :"+name);
		int sayi = 10;
		double kayi;
		kayi = (double)sayi /3;
		System.out.println("Sayı = "+ kayi);
		*/
		/*
		String name = JOptionPane.showInputDialog("enter yorur name");
		JOptionPane.showMessageDialog(null, name);
		
		//age = JOptionPane.showInputDialog("enter zour age");
		// bu thiss will return string to make it int we will use as below
		int age= Integer.parseInt(JOptionPane.showInputDialog("ya gir"));
		*/
		/*
		double x,y,z;
		Scanner scanner = new Scanner(System.in);
		System.out.println("enter side x :");
		x= scanner.nextDouble();
		System.out.println("enter side y :");
		y= scanner.nextDouble();
		
		z = Math.sqrt((x*x)+(y*y));
		System.out.println("Hipotenüs = "+z);
		scanner.close();
		*/
		
		
	
	

Leave a Reply