This file contains hidden or 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
| public class Main { | |
| /* | |
| == , !=, >, >=, <, <= | |
| */ | |
| public static void main(String[] args) { | |
| boolean isActive = true; | |
| System.out.println(isActive); |
This file contains hidden or 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
| public class Main { | |
| /* | |
| letter A | |
| decimal value 65 | |
| unicode value U+0041 | |
| */ | |
| public static void main(String[] args) { | |
| char myChar = 'A'; |
This file contains hidden or 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
| public class Main { | |
| public static void main(String[] args) { | |
| //myVariable = 45; | |
| //char myVariable = 'A'; | |
| var myVariable = 45; | |
| System.out.println(myVariable); | |
| var myVariable2 = 'A'; |
This file contains hidden or 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
| public class Main { | |
| /* | |
| print double quote I love "food" \" | |
| print new line \n | |
| print indentation \t | |
| pint backslash | |
| */ | |
| public static void main(String[] args) { |
This file contains hidden or 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
| public class Main { | |
| /* | |
| My name is John | |
| I live in france since 2023 | |
| My salary is 45.55555589 | |
| */ | |
| public static void main(String[] args) { | |
| String name = "John"; | |
| int year = 2023; |
This file contains hidden or 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
| import java.util.Scanner; | |
| public class Main { | |
| /* | |
| 1- Import the Scanner class from java.util package. | |
| 2- Create an object from the class Scanner. | |
| 3- Use methods available in the Scanner object. | |
| 4- Close the scanner object. | |
| */ |
This file contains hidden or 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
| import java.util.Scanner; | |
| public class Main { | |
| /* | |
| next | |
| nextLine() | |
| nextInt() | |
| nextDouble() | |
| */ |
This file contains hidden or 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
| import java.util.Scanner; | |
| public class Main { | |
| /* | |
| Make a program that takes Fahrenheit temperature and converts it to Celsius | |
| Formula: c = (f - 32) / 1.8; | |
| */ | |
| public static void main(String[] args) { | |
| Scanner in = new Scanner(System.in); |
This file contains hidden or 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
| public class Main { | |
| public static void main(String[] args) { | |
| System.out.println("byte min : " + Byte.MIN_VALUE + ", byte max : " + Byte.MAX_VALUE ); | |
| System.out.println("short min : " + Short.MIN_VALUE + ", short max : " + Short.MAX_VALUE ); | |
| System.out.println("integer min : " + Integer.MIN_VALUE + ", integer max : " + Integer.MAX_VALUE ); | |
| System.out.println("long min : " + Long.MIN_VALUE + ", long max : " + Long.MAX_VALUE ); | |
| System.out.println("float min : " + Float.MIN_VALUE + ", float max : " + Float.MAX_VALUE ); |
This file contains hidden or 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
| import java.util.Scanner; | |
| public class Main { | |
| public static void main(String[] args) { | |
| Scanner in = new Scanner(System.in); | |
| int grade = in.nextInt(); | |
| if (grade >= 90) { | |
| System.out.println("A"); |