This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
for(initialization; condition ; increment/decrement) | |
{ | |
statement(s); | |
} | |
////////// Standart use of "for" | |
for(int a=29; a>=1; a--){ | |
System.out.println("The value of a is: "+a); | |
////////// Infinite "for" loop | |
class infiniteex { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.company; | |
import java.util.Scanner; | |
public class Main { | |
public static void main(String ... args) { | |
int number; | |
int answer = 0; | |
boolean boo = true; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Data Abstraction is the property by virtue of which only the essential details are displayed to the user. The trivial or the non-essentials units are not displayed to the user. Ex: A phone is viewed as a phone rather than its individual components. | |
class Phone{ | |
int name; | |
int size; | |
int type; | |
int country; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// High-level modules shouldn’t depend on lower-level modules. All of them must depend on abstractions. | |
// Abstractions shouldn’t depend on the details. Details must depend on the abstractions. | |
class Michel { | |
private $foodProvider | |
public function (IFoodProvider $foodProvider){ | |
$this -> foodProvider = $foodProvider | |
} | |
public function eat () { | |
$food= $this -> foodProvider -> getFood(); |