tutorial 4:
class Main{
//method
//method header
public static void main(String[]args){
//method body
[Link]("Hello Youtube");//println is a built in method
//[Link] means=print line in the system
//method header and method body together create something called a method
tutorial 5:
class Main{
public static void main(String[]args){
//variable in java is pretty much like a placeholder for something else
//int, double, float are keywords
//double means working with a number but that number can have a decimal point as well
double tuna;//declaring a variable
//tuna is a variable name
tuna=5.28;//assigning a variable
//5.28 is the value of variable, = is assignment operator
[Link]("I want");
[Link](tuna);
[Link](" movies");//after this move to the nextline because of println
//(println)when it get's to the end of printing it, it moves to the next line
[Link]("apples");
tutorial 6:
//basics of how to get input from the keyboard
//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
//Scanner(means we are going to use scanner) buck(variable name)=new Scanner([Link]);
//buck variable is whatever information is in the keyboard
//Scanner is already built in java
//the way to get the scanner is to import it
import [Link];//used for getting the Scanner
class Main{
public static void main(String[]args){
Scanner buck=new Scanner([Link]); //[Link] stands for system input
//input we have in the computer is the keyboard
//so whatever we type in for the keyboard hold in our buck variable
[Link]([Link]());
//nexLine(), what this is going to do is allow you to pause and wait untill
//you get input from Scanner buck=new Scanner([Link]);
//buck is a scanner variable
//at output if i write hey now, then buck=hey now, whenever i print buck, hey now will be shown
//if we don't import the scanner, we can never use it
//what scanner does, it takes the information that user types in from their keyboard and stores in a
variable
tutorial 7:
import [Link];
class Main{
public static void main(String[]args){
Scanner buck=new Scanner([Link]);
double fnum, snum, total;
[Link]("ENter first num");
fnum=[Link]();
[Link]("ENter second num");
snum=[Link]();
total=fnum+snum;
[Link](total);
double totall;
totall=[Link]()+[Link]();
[Link](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
How Does Reading Improve Critical Thinking? [10 Reasons]
import [Link];
class Main{
public static void main(String[]args){
Scanner buck=new Scanner([Link]);
double girls, boys, people;
girls=7;
boys=3;
people=girls/boys;
[Link](people);
people=girls%boys;
[Link](people);
tutorial 9:
int tuna=5;
[Link](tuna++);
//first post increment will use this variable as 5 and then will change it to 6.
tutorial 10:
class Main{
public static void main(String[]args){
int test=6;
if(test < 9){
[Link]("yes");
}else{
[Link]("this is else");
tutorial 10:
class Main{
public static void main(String[]args){
int boy, girl;
boy=8;
girl=99;
if(boy>10&& girl<60){
[Link]("you can enter");
else{
[Link]("you can not enter");