Java Tutorials
Java Tutorials
class Main{
//method
//method header
//method body
//method header and method body together create something called a method
tutorial 5:
class Main{
//double means working with a number but that number can have a decimal point as well
tuna=5.28;//assigning a variable
System.out.print("I want");
System.out.print(tuna);
//(println)when it get's to the end of printing it, it moves to the next line
System.out.print("apples");
tutorial 6:
//WE NEED TO MAKES A VARiable that's gonna hold a value from the keyboard before we use it we need
to write scanner in main method
class Main{
//so whatever we type in for the keyboard hold in our buck variable
System.out.println(buck.nextLine());
//nexLine(), what this is going to do is allow you to pause and wait untill
//at output if i write hey now, then buck=hey now, whenever i print buck, hey now will be shown
//what scanner does, it takes the information that user types in from their keyboard and stores in a
variable
tutorial 7:
import java.util.Scanner;
class Main{
fnum=buck.nextDouble();
snum=buck.nextDouble();
total=fnum+snum;
System.out.println(total);
double totall;
totall=buck.nextDouble()+buck.nextDouble();
System.out.println(totall);
tutorial 8:
int are whole numbers like 6,76 etc without decimal point.
Modulo or Remainder Operator returns the remainder of the two numbers after division. If you are
provided with two numbers, say A and B, A is the dividend and B is the divisor, A mod B is there a
remainder of the division of A and B. Modulo operator is an arithmetical operator which is denoted by
%.23-Feb-2022
Reading allows individuals to engage with diverse perspectives, ideas, and arguments, which can help
stimulate and develop critical thinking skills. It helps to build the capacity for logical reasoning, problem-
solving, and decision-making, making you more prepared to deal with unfamiliar situations.05-Dec-2022
import java.util.Scanner;
class Main{
girls=7;
boys=3;
people=girls/boys;
System.out.println(people);
people=girls%boys;
System.out.println(people);
tutorial 9:
int tuna=5;
System.out.println(tuna++);
//first post increment will use this variable as 5 and then will change it to 6.
tutorial 10:
class Main{
int test=6;
if(test < 9){
System.out.println("yes");
}else{
System.out.println("this is else");
tutorial 10:
class Main{
boy=8;
girl=99;
if(boy>10&& girl<60){
else{