uzzal-mondal / Java-BasicOOPProblemSolving

JavaBasicProblemSolving

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Java-Basic---OOP---ProblemSolving

JavaBasicProblemSolving

Java Tutorial

Tutorial Java Intro: 01 Java :

java holo high level programming language. Eta develop kore sun micro system but currently own by oracle.

Why we should learn java / feature java:

  1. Platform independent language.(WORA) – write once run anyway- all operating system code to be supported any place just like java independent.

2. Object oriented –

real life er sathe object gulo mil reke amara programming korbo.

  1. Java supported web based application.

  2. Robust language : - that means eti akti strong and sequence language. Erroe handling ba exception handling er flexible ase.

  3. Secure programming language.

  4. Multi-threading programming:- language. Akoi sathe onek gulo kaj kora jai. Say music, game, any pdf open seta backend a rakha jai. Say 20 liner code asi sekhan theke 100 liner code a jump korte pare.

  5. Draw:- c/c++ Jodi kono windows operating system a ami run kore thaki tahole se run korbe kintuo oi akoi programming niye Jodi ami c/c++ code linux a run kore thaki tahole kintuo run korbena.

  6. But java all operating system a supported e jonno java ke amara platform independent language bole thaki. Java virtual machine er karone java platform language. JVM

  7. Java Run :-

  8. Fast java code . dile extension thake.

  9. Java code ti compiler er maddhome akta byte code a convert kore jvm a niye ase. Jar jonno windows, lenux, Mac sokol operating a run korte pare.

  10. History of java:

  11. Required software:
    #jdk – java development kids #ide – Integreated development enviornment eclipse/netbeans/inteli j idea.

  12. Java version : -

  13. Java Diagram:-

Tutorial: 1 Completed learn

The End of part Java Intro

First Java Application: T : 02

  1. Project under– package uder– class.

  2. Package / class name always start to capital letter.

  3. Java program a akta user defined class thakbe.

1st access modifier. – public , protected , private # 2nd class keyword

#3rd class name

class use korar jonno class keyword ti use kora hoyese.

Create class :- Exm: public class pro {
}

  1. Java starting point thakbe jekhan theke program execute hoy ba run hoy. Program compile korte pare. Just like call main method .

Create method: - Ex: public static void main(String args[]) {

}

Public – acces modifier Static – java keyword , fixed ase Void – kono kisu return korbe Main – main method () first bracket thakle setake method hisabe sinbo.

  1. Java keyword bola hoye thake. Jamon public , static void , main.

  2. Create to java program Display:

System.out.println(“ “ ); Etake statement o bola hoy statement er sese semiclone dite hoy.

  1. Println(“Java”); - print korar somoy akta line print kore thake.

  2. Print(“java”); - print korar somoy kono line, print kore thakena. Akoi line a print hoy.

Tutorial: 2 Completed learn
The End of part First java app#

Escape Sequence T: - 03

What is Escape sequence :- Eta akta special character jeta thakbe backslash sinno er pore , etake escape sequence ba backslash char o bola hoy.

escape sequence gulo obossho “” cotation er vitore thakte hobe.

\ - backslash 
\b – backspace – sei num/word muse jabe. 
\t – tab – 4 ghor porjonto faka nibe. 
\n – newline 
\r – carriage return – samne ja thakbe clear hoye jabe like – about\r dile about thakbena.  
\ “ – double quote- double quote hobe – “u” 
\’ – single quote – ‘u’ 
\\ – backslash -  uzz\\al -  output  uzz\al 

Java Scape Sequence

\t - Inserts a tab in the text at this point. \b - Inserts a backspace in the text at this point. \n - Inserts a newline in the text at this point. \r - Inserts a carriage return in the text at this point. \f - Inserts a form feed in the text at this point. ' - Inserts a single quote character in the text at this point. " - Inserts a double quote character in the text at this point. \ - Inserts a backslash character in the text at this point.

package Feburary;

public class FastIntro {

public static void main( String args[]){

    // tab 
 System.out.println("1 \t5"); 

    //break 
 System.out.println("Banglade\bsh is our homeland");  
 System.out.println("This is my Techoners\n is our pleasure");  
      
 System.out.println("Bangla\rdesh is our");  
 System.out.println("Bangla\fdesh is our ");  
 System.out.println("I will give mo\'re thing's 

Techoners");

 System.out.println(" \"Java programming language\" 

");

 System.out.println("Teconer is my fa\\st Job career"); 

} }

The best article..:---

System.out.println(""Uzzal" Mon\dal\n Android learner \t 0198\b045\r0700");

Tutorial: 3 Completed learn

The End of part Escape sequyence

Java Execution Start / Java phases Tutorial num – 04

  1. Eropr java compiler thkeke byte code a jai
  2. Java virtual machine thke program ta excute hoy

Tutorial: 4 Completed learn

The End of part Java Phases Tutorial

Tutorial : 05

Varibale and DataType In Java

Varibale and Data Type

Variable - 1.if any data storage to including value, this call variable. num1- variable , 20 is value

  1. Variable write to rules:
  2. Variable write to rules:

Variable name digit / math don’t start to decleare. keyword function/method name don’t start to decleare.

  1. Variable delceration syantax:
    • Fast dattype • Second variable. • int a = 10;
    • - int datatype , a variable – 10 value.

Data type in java:

Data type 02 prokar.

Primitive datatype

Numeric, Integral. Integral- character char, Integral. Integer – byte, short, Int, long. Floating point – float , double.

Primitive Data type (8)– Boolean, char ,int, byte, short, long, float, double.

Non- primitive datatype- String, Array, etc.

          Compiler blog 

package FeburaryJAVA;

Data type and variable..

public class SecondJava {

public static void main(String args[]) {         int num = 10; 
    float point = (float) 10.25;         double result = 100.20;         boolean go = true; 

    // variable declear, variable intilize korbo.         char c;         char ca = 'a'; //dynamic initlize. 
    int i;         double d;         float f;         short s;         byte b=127;         boolean b1;         long l; 


    /*byte variable:  8 bit,  min -128, max 127, default 0;  */ 

    byte by = 127;         byte byt = -128; 
    System.out.println("Byte = "+by); 
    System.out.println("Byte = "+byt); 

    /*short variable 16 bit,# max 32,768 # min -32767 

*/ short sh = 32767; short sho = -32768; System.out.println("short "+sh); System.out.println("short "+sho);

    /*Int variable 32 bit - #max 2147483647  #min -

2147483648*/ int i1 = 2147483647; int i2 = -2147483648; System.out.println("Int : "+i1); System.out.println("Int : "+i2);

      /* long 64 bit #max9,223,372,036,854,775,807   min -9,223,372,036,854,775,808(-2^63) 

       */ 

      /**/ 
     long lo = 1000L;          long lon = 2000L; 
     System.out.println("Long varibale "+lo); 
     System.out.println("Long varibale "+lon); 

     /*float 32 bit.  754 floating point 
     * float f1 = 10.25f*/          float folat  =  10.25f; 
     System.out.println("Float : "+folat);  
     /*double 64bit, 754 floating point*/ 

     double db = 120.45; 
     System.out.println("Double value is a "+db); 


     /*boolean return to true and false.*/ 
    boolean one = false; 
    System.out.println("Boolean value is  a : "+one);  



    /*character is a 16 bit */ 

    char ch = 'a'; 
    System.out.println("Character : "+ch); 
} 

}

Special bolg

  1. Variables are nothing but reserved memory locations to store values. This means that when you create a variable you reserve some space in the memory.

  2. Based on the data type of a variable, the operating system allocates memory and decides what can be stored in the reserved memory. Therefore, by assigning different data types to variables, you can store integers, decimals, or characters in these variables.

There are two data types available in Java −

• Primitive Data Types • Reference/Object Data Types

Primitive Data Types

There are eight primitive datatypes supported by Java. Primitive datatypes are predefined by the language and named by a keyword. Let us now look into the eight primitive data types in detail.

Byte

• Byte data type is an 8-bit signed two's complement integer

• Minimum value is -128 (-2^7)

• Maximum value is 127 (inclusive)(2^7 -1)

• Default value is 0

• Byte data type is used to save space in large arrays, mainly in place of integers, since a byte is four times smaller than an integer.

• Example: byte a = 100, byte b = -50

short

• Short data type is a 16-bit signed two's complement integer • Minimum value is -32,768 (-2^15) • Maximum value is 32,767 (inclusive) (2^15 -1) • Short data type can also be used to save memory as byte data type. A short is 2 times smaller than an integer • Default value is 0. • Example: short s = 10000, short r = -20000 int • Int data type is a 32-bit signed two's complement integer. • Minimum value is - 2,147,483,648 (-2^31) • Maximum value is 2,147,483,647(inclusive) (2^31 -1) • Integer is generally used as the default data type for integral values unless there is a concern about memory. • The default value is 0 • Example: int a = 100000, int b = -200000

long

• Long data type is a 64-bit signed two's complement integer • Minimum value is -9,223,372,036,854,775,808(-2^63) • Maximum value is 9,223,372,036,854,775,807 (inclusive)(2^63 -1) • This type is used when a wider range than int is needed • Default value is 0L • Example: long a = 100000L, long b = -200000L float • Float data type is a single-precision 32-bit IEEE 754 floating point • Float is mainly used to save memory in large arrays of floating point numbers • Default value is 0.0f • Float data type is never used for precise values such as currency • Example: float f1 = 234.5f

double

• double data type is a double-precision 64-bit IEEE 754 floating point • This data type is generally used as the default data type for decimal values, generally the default choice • Double data type should never be used for precise values such as currency • Default value is 0.0d • Example: double d1 = 123.4

boolean

• boolean data type represents one bit of information • There are only two possible values: true and false • This data type is used for simple flags that track true/false conditions • Default value is false • Example: boolean one = true

char

• char data type is a single 16-bit Unicode character • Minimum value is '\u0000' (or 0) • Maximum value is '\uffff' (or 65,535 inclusive) • Char data type is used to store any character • Example: char letterA = 'A'

Reference Datatypes

• Reference variables are created using defined constructors of the classes. They are used to access objects. These variables are declared to be of a specific type that cannot be changed. For example, Employee, Puppy, etc. • Class objects and various type of array variables come under reference datatype. • Default value of any reference variable is null. • A reference variable can be used to refer any object of the declared type or any compatible type. • Example: Animal animal = new Animal("giraffe");

Java Literals

A literal is a source code representation of a fixed value. They are represented directly in the code without any computation. Literals can be assigned to any primitive type variable. For example − byte a = 68; char a = 'A'; byte, int, long, and short can be expressed in decimal(base 10), hexadecimal(base 16) or octal(base 8) number systems as well. Prefix 0 is used to indicate octal, and prefix 0x indicates hexadecimal when using these number systems for literals. For example − int decimal = 100; int octal = 0144; int hexa = 0x64; String literals in Java are specified like they are in most other languages by enclosing a sequence of characters between a pair of double quotes. Examples of string literals are − Example "Hello World" "two\nlines" ""This is in quotes"" String and char types of literals can contain any Unicode characters. For example − char a = '\u0001'; String a = "\u0001";

Java language supports few special escape sequences for String and char literals as well. They are −

Notation Character represented \n Newline (0x0a) \r Carriage return (0x0d) \f Formfeed (0x0c) \b Backspace (0x08) \s Space (0x20) \t tab " Double quote ' Single quote \ backslash \ddd Octal character (ddd) \uxxxx Hexadecimal UNICODE character (xxxx) What is Next? This chapter explained the various data types. The next topic explains different variable types and their usage. This will give you a good

    End of data type / variable Tutorial:-  5 

Tutorial : 06

Format Spec fire In Java

  1. Today use to printf method .

  2. System.out.printf(“folat num = %f, f)

  3. Format specifire holo %f

  4. Format specifire must be used printf,
    Not for println, print

  5. Char %c, c, value print

  6. Boolean %b, b

  7. Int , sort, byte, long – 4 ti holo int data type er purrnoo number. %d

  8. Float %f, then value print.

  9. Double %f

  10. String %s

Example: package FeburaryJAVA;

public class FormatSpecifire4 {

public static void main(String args[]){ 



    boolean b = true;         char c = 'B';         double num = 10.2562548;         int result = 100;         float f = 10.26f;         byte by = 5;         short s = 25;         long l = 200; 

    System.out.printf("boolean num = %b\n",b); 
    System.out.printf("Character c = %c\n",c); 
    System.out.printf("double result of = %f\n",num); 
    System.out.printf("Integer value is a = 

%d\n",result); System.out.printf("folat value is a = %.2f\n",f);
// 2 numb menas 2 num point i can see System.out.printf("Byte value is a = %d\n",by); System.out.printf("Short value is a = %d\n",s); System.out.printf("Long value is a = %d\n",l);

} } 

The End Of java format specifier Tutoria - 06

Tutorial No: - 07

-:How to get User Input:-

// java User input

System.out.println("Enter your data"); Scanner sc = new Scanner(System.in);

long l = sc.nextLong(); System.out.println("Long value = "+l);

//sort

short s = sc.nextShort(); System.out.println("Short data : "+s);

//byte byte n = 100;

System.out.println("Byte data : "+n);

//float

float fl = sc.nextFloat(); System.out.println("Float data: "+fl);

//string

String name = sc.nextLine(); System.out.println("String data: "+name);

//double

double res = sc.nextDouble(); System.out.println("Double data : "+res);

//int data type int num = sc.nextInt();

System.out.println("Int data: "+num);

Java User Input:

https://www.tutorialspoint.com/java/util/java_util_scan ner.htm

  1. Scanner class use korte hobe.
  2. package FeburaryJAVA;
    import java.util.Scanner;

public class UserInput {

public static void main(String args[]){ 

    double number ; 
    Scanner st  = new Scanner(System.in);         System.out.println("Please double number");         number  = st.nextDouble(); 
    System.out.println("this double number : 

"+number);

      String name ; 
    Scanner  sc = new Scanner(System.in);         System.out.println("please your name");         name = sc.nextLine(); 

Tutorial No: 07

Arithmetic Operator:-

1. Oerator , Operand , Expression:-

Operator:- +,-,*,/ , = ei gulo operator. Operand:- jader niye + ,- kora hoy take operand bole Constant value:- j man paoa jabe with equal (=) er pore jeta thakbe seta amder constant value . Expression:- operator , operand, Constant value niyei amder Expression.

  1. Type of Operator : 8 type’s are opertor in java.

3. Arithmetic Operator: 5 type’s of arithmetic operator:

Example:-
System.out.println("Enter your data: "); Scanner sc = new Scanner(System.in);

int a,b, res; a = sc.nextInt(); b = sc.nextInt();

// addition

res = a+b; System.out.println("Addition: "+res);

res = a-b; System.out.println("Subtraction "+res);

res = a*b; System.out.println("multiplication: "+res);
double ans = (double) a/b; // convert to - int to double parse // type cust to int to double System.out.println("Division : "+ans); res = a%b; System.out.println("Modulas : " +res);

4. Assignment operator: 6 type’s of assignment operator

= Assign operator += plus Assign Operator -= minus Assign operator *= multiply assign operator /= division assign operator %= modulus assign operator

Example:-

//java Alignment operator int x = 5; int y = 3;

// plus alignment operator then x er man asign hosse.. x += y; // x = x+y = 8 System.out.println("x plus : " + x);

// minus alignment operator x-=y; // x = x-y = 8-3 = 5 System.out.println("x minus : "+x);

// multiply alignment operator x*=y; //x = xy = 53 = 15 System.out.println("x multi : "+x);

// division alignment operator x/=y; //x = x*y = 15/3 = 5 System.out.println("x div: "+x);

// modulus alignment operator x%=y; // x = x%y = 5%3 = 2 modulus 2 System.out.println("X mod: "+x);

Area of formula is almost done it git.

https://gist.github.com/uzzalmondalcse/c3 40e3058f4364d37126258067dc1a1b Temperature programming solve, show to gist… https://gist.github.com/uzzalmondalcse/6a24d353 3690f21da3f4017fa3aedd71

The end of Tutorial 07: Arithmetic with assignment oPerator....@@@@####

Tutorial num:- 08

-- Unary Operator --

Unary:- akti mattro operand er sathe Jodi kono operator add kora hoy tahole unary operator bola hoy like +a;

unary operator j man thakbe Jodi plus hoy tahole gun korbe minus hole minus gun korbe.. Example:-

//Unary Operator + , - int x = -10; int res;

res = +x; System.out.println("Unnary plus: "+res);

res = -x; System.out.println("Unnary minus: "+res);

Increment :- ++; Unary plus er sathe ak ak kore barano hoy.

Decrement: -- Unary minus er sathe ak ak kore komanohoy.

Increment – Decrement operator k 02 vage vag kora hoy, prefix and postfix..

++a – Jodi kono variable er age bose prefix increment operator. Age bosle ak jog hoye jai
--a – Jodi kono variable er age bose prefix decrement operator.. a ++ - Jodi kono variable er pore bose postfix increment operator. a-- - Jodi kono variable er pore bose postfix decrement operator.

++x = valur man agei barbe , and valu ter sathe add hobe.. etake bola hoy prefix.

X++ = valur man agei barbena , pore barbe othat pore Jodi kono value pai tahole sei valur sathe add hoe e joono etake bola hoy postfix

operator..

Unnarry Operator Unary +, unary – Unaary ++; Unaary--

  1. Akti mattro operand er sathe j man gun kora hoy take unnnary operator bole Like - +a; -b; *c; /d
    package FeburaryJAVA;

public class unaryOperator {

public static void main(String args [ ]){ 

    int a=10, b=-5, result; 

    result = +a; 
    System.out.println(result); 

    result = -b; 

    System.out.println(result); 


} 

}

Most Important Unnary Operator

  1. prefix = ++a
  2. postfix = a++;
  3. prefix holo man pabe barbe…
  4. postfix holo sathe sathe noy pore Jodi oi valur man assign hoy tokon se barbee.

public class unaryOperator {

public static void main(String args [ ]){ 

    //unnary ++; unnarry -- operator. 
    // prefix ++a;  postfix a++ 

    int a=10, b; 

    b =  a++;  //11 
    System.out.println("B = "+b); 

    b= ++a; //11 
    System.out.println("B = "+b); 

    b = --a; 
    System.out.println("B="+b); 

Tutorial:v08 unary programming now End..

Tutorial: 10

Control statement If else:-

Even Odd num:

Scanner sc = new Scanner(System.in); System.out.println("Enter a num"); int num = sc.nextInt();

if (num%2==0){

System.out.println("Even num"+num); 

}else if(num%2!=0){

System.out.println("Odd num "+num); 

}else {

System.out.println("The input is not correct"); 

}

Vowel and Consonant

//Vowel and consonant

Scanner sc = new Scanner(System.in); System.out.println("Please input letter "); char v = sc.next().charAt(0);

if (v=='a' || v=='e' || v=='i' || v=='o' || v=='u'){

 System.out.println("Vowel "+v); 

}else if(v=='b' || v=='c' || v=='d' || v=='f' || v=='j' || v=='h'

     || v=='i' || v=='j' || v=='k' || v=='l' || v=='m' || v=='n' 

     || v=='p' || v=='q' || v=='r' || v=='s' || v=='t' || v=='v' 
     || v=='w'  || v=='x' || v=='y' || v=='z' ){ 

 System.out.println("Consonant "+v); 

}else {

 System.out.println("hey , your cannot input vowel and consonant "); 

}

Tutorial end 10 .. Control statement if else Done

Tutorial 11

Logical Operator

  1. Dui ba totodhik condition er moddhe shomporko sthaponer jonno logical Operator use kora hoy.

  2. Java te 03 dhoroner logical operator ase,

  3. Logical AND-&&, OR-||, NOT -!.

Learn Logical And &&

  1. Dui ba totodhik condition jokon true hobe tokon seta ke amara logical and operator bole thakbo. Condition jotogula thakbe true hole amder j statement tahkbe statement tokon kaj korbe.

Important:-

  1. Akta false then statement is false .
  2. All item’s are true then statement is true.

3. All Condition true hole ture , statement er moddhe dukhbe, akta condition false hole statement er moddhe dukhbena.

Example 02:-
package FeburaryJAVA;

public class logicalAnd {

public static void main(String args[]){ 

    int num1 = 10, num2 = 20, num3 = 30;         boolean result; 

    result = ((num1!=num2) && (num2!=num1) && 

(num3>num2));

    System.out.println(result); 

    result = ((num1!=num2) && (num2!=num1) && (num3==num2)); 
     
        System.out.println(result); 

} 

}

learn Logical OR(||)

  1. Onek gulo condition thakbe amder j kono akta true korar projon hobe e jonno amra logical Or ei Operator bole thakbo. R j kono akta true hole amder condition er statement kaj korbe

Important:

  1. Sob gulo theke akta item Jodi true hoy tahole true.
  2. Sob gulo item Jodi false hoy tahole false ashbe.

Example:-1 package FeburaryJAVA;

public class LogicalOperator {

public static void main(String args[]){ 

    //Logical operator.. 

    int num1 = 1, num2 = 5, num3 = 10;         boolean result; 

   result =   ((num1>=num2) || (num2>=num3) || 

(num3>=num1));

        System.out.println(result); 

        result = ((num2<=num1) || (num3<=num2) || 

(num3<=num1)); System.out.println(result);

} 

}

op – true , flase;

learn Logical notEqual(!=)

  1. Kono item soman noy take logical not equal bola hoye thake.
  2. Jodi soman thake tahole stamen kaj korbena r Jodi not equal soman na hoy tahole ter statement kaj korbe..

End of Tutoiral 11 logical operator.

Tutorial : 12 ;) Switch Case

Switch Case In Java 20.02.19

  1. Switch, case, break, default, – 04 keyword sure neccessare

  2. break and default mandatory.

  3. If-else er motoni switch statement tobe switch case er maddhome amra if-else er moton ei kaj chelate pari.

  4. Switch statement excite one statement of multiple conditions

  5. Keyword statement to on other switch statement

switch, case , break, default.

  1. switch(expression){ } switch er moddhe kono akta value / experrision amara patch korbo.

  2. Switch block er moddhe onek gulo condition thakbe / onek gulo case thakbe. Jamonta if er moddhe koresilam.

  3. Amra j value ta pass korbo seta Jodi
    Ei valur sathe match hoy tahole amader statement kaj korbe and break korbe. Othat nise jaoar r kono projon nei. Amder condition/ expression onujahi Jodi expression match kore thole sei case er/ statement ti kaj korbe and break hobe nise jaor projon hobena.

  4. Erokom onekgulo case use korte paril, Jodi kono case er sathe match na kore tahole amara jeta use korbo seta holo default. Onekta else er moton. Sure kaj korbe.

Tutorial - 12
End of Java Switch..

Tutorial – 13

Java conditional / ternary Operator:- Java Conditional Operator 23.02.19

  1. Conditional operator kea amara Ternary operator bole thaki.

  2. experession1? expression2: expression3

  3. ei 3 ta operand niye kaj kore bole eke a amara ternary operator / conditional operator bole thaki.

  4. ? – if er motn kaj kore,

  5. : - else er moton kaj kore.

  6. experession1 jodi true hoy – expression2 eita kaj korbe

  7. experession1 jodi falase hoy – expression3 eita kaj korbe.

Example:-

Fast exp y er thke x boro tahole x kaj korbe , Jodi fast condition false hoto tahole y er man kaj korto..

Example code:

package FeburaryJAVA;

import java.util.Scanner;

public class CoditonalOperrator {

public static void main(String args[]){ 

    int num1,num2,large; 

    Scanner sc = new Scanner(System.in); 
    System.out.println("Enter two number data:- ");         num1 = sc.nextInt();         num2 = sc.nextInt(); 

    large = (num1>num2)? num1 : num2; 

    System.out.println("Large Nume: - "+large); 

} 

}

Java Ternary / Conditional operator end Now… Tutorial 13

Tutorial : 14

Java Math Class

Java Math Class

  1. https://docs.oracle.com/javase/8/do cs/api/java/lang/Math.html

  2. Java Maximum and Minimum

int max = Math.max(x,y);

int min = Math.min(x,y);

3. Java Absolute method eti (- minus ) man ke +(plus ) kore dibe.

// absulate value. int abs = Math.abs(y); System.out.println("Absoulate value = "+abs);

4. Java power(pow) ei method . ami int man dile problem nai kintu return korbe double type er.

// power class Int x = 2, y = 3
double pow = Math.pow(x, y);
System.out.println("Power = "+pow);
Ekhane power mane x = 2 and y er man 3 . akon 2 er power hobe y er value 3 23 = 8.

5. Math class er round niye kaj korbo. Round holo float type er akta man k se int e return kore and kaskasi kono sonkha 5.5 hole se 6 output dai.

//round class
float ro = Math.round(5.5f);
System.out.println("Round class = "+ro);

6. Pi er man ti akdomi static variable er moton

  1. // pi class double pi = Math.PI;
    System.out.println("pi valu of :-"+pi);

All example:

package FeburaryJAVA;

public class MathDemo {

public static void main(String args[]){ 

  int x = 2, y = 3; 
    int max = Math.max(x,y);       int min = Math.min(x,y); 
  System.out.println("Maximum value = "+max);       System.out.println("Minium  value = "+min); 

  // absulate value. 
    int abs = Math.abs(y); 
    System.out.println("Absoulate value = "+abs); 

    // power class 
    double pow = Math.pow(x, y);         System.out.println("Power  = "+pow); 

    //round class 
    float ro = Math.round(5.5f); 
    System.out.println("Round class = "+ro); 

    // pi class         double pi = Math.PI; 
    System.out.println("pi valu of :-"+pi); 

} 

}

Tutoiral 14 now End Java Math Class..

Tutorial 15

Java for loop

Java For Loop 25.02.19

  1. Loop er sahajee kono akta kajke amara bar bar sompdhon korte pari. Kono akta statement ba multiple statement k amara bar bar sompodhon korte pari.
  2. For loop er jono amder jeta projon seta holo first for keyword projon.
  3. Akta for loop er 3 ta part thake,

For keyword

initilige part - koto theke loop ta suru

hobe

condition – akta loop kotobar cholbe ta depend korbe ei condition er upor. must be true to condition.

increment or decrement part initlize

kintuo initialized part a akbari jabe second bar r jabena. Jotobar vitore jak na kno condition true hole se jeteparbe. Vitore ashbe statement print korbe .. Then protibar increment / decrement part intilize hobe, mane 1 , 1 kore barbe.

Example that: package FeburaryJAVA;

public class someOfNumberFor {

public static void main(String args[]){ 

// for (int i = 1; i<=10; i++){ // // // if(i%2==0){ // // System.out.println(i); // } // // // }

// for (int i = 0; i<=10; i++){ // // System.out.println(i); //

// if (i==5){ // break; // } // // } System.out.println("loop over");

// int i, j; // // for (i= 1; i<=5; i++){ // // for (j=1; j<=5; j++){ // // if (i==1 || i==5 || j==1 || j==5){ // // System.out.print("*"); // } // // else { // // System.out.print(" "); // } // } // // System.out.println(); // }

// int i,j; // // for( i = 1; i<=5; i++){ // // for (j=1; j<=5; j++){ // // if (i==1 || i==5 || j==1 || j==5){ // // System.out.print("*"); // }else{ // // System.out.print(" "); // } // // if (j==5){ // System.out.println(); // } // } // }

// for (int i = 5 ; i>=1; i--){ // // for (int j=i; j>=1; j--){ // // System.out.print("*"); // } // // System.out.println(); // }

// for (int i =0; i<=5; i++){ // // for (int j=1; j<=i; j++){ // // System.out.print("*"); // } // // System.out.println(); // }

//sum of even odd using loop

// for (int i = 0; i<=20; i++){ // // // if (i%2==0){ // // System.out.println("Even num "+i); // }else if(i%2!=0){ // // System.out.println("Odd num : "+i);

// }else{ // // System.out.println("Num isn't correct"); // } // // }

// sum of the number using Loop...@@@@@@@@

// int s=0, len; // len = args.length; // // for (int i =0; i<len; i++){ // // int x = Integer.parseInt(args[i]); // s = s+x; // } // // System.out.println("Sum of command line of arguments: "+s);

// simple Loop...@@@@@@@@

// for (int i=0; i<=10; i=i+2){ // // System.out.println("bangladesh : "+i); // }

} 

}

The End of for loop java tutorial 15

Tutorial – 16

Java do while loop

Java Do While Loop 01.03.2019

  1. int I =0; firstly initialize part

  2. do{ //statement System.out.println(); i++; // increment -decremetnt }while(i<10);

  3. do while loop akbarer jonno o print hobe , statement print hobe . r erpor Jodi condition false thake tahole se terminate hoye jabe . tokon r loop ti kaj korbena.

Tutorial - 17 Java while loop

Java while loop 01.03.2019

  1. Firstly initialize part – i = 0

  2. Secondly while(condition)

  3. Thirdly body

  4. Body er moddhe statement then increment / decrement .

  5. Jotokhon porjonto condition part ture tahakbe totokhon porjonto loop ta cholte thakbe. Body er moddhe statement gulo print korbe . increment decrement part o thakbe bar bar update hobe.

  6. Jokon condition false hobe tokon r body er moddhe jabena.

  7. While loop bade porer j code gulo tahkbe oi gula print hote thakbe.

Tutorial 18

Break and continue statement

Break and continue statement

Example: package FeburaryJAVA;

public class breakAndContinueStatement {

public static void main(String args[]){ 

    for (int i = 100; i>=80; i--){ 

        if (i==90){                 continue; 
        } 

        System.out.println(i); 
    } 

// for (int i = 0; i<100; i=i+2){ // // // if (i==10){ // // break; // } // // System.out.println(i); // // }

} 

}

the end of Tutorial 18

Tutoiral 19 Java Array

Learn Array:

  1. Using Array – int[] num = new int[10];

  2. Delcear Array – int [] num; String[]names

  3. Create – num = new int[10];

  4. Num[10] – size – 10 ta value ase amar.

  5. Num[0] – index/subscript – 0,9 porjonto 9 ta index create korte hobe. Kom hole no prob, beshi hole out of exception dibe.

  6. Array index print – just print array index

  7. Array size print – length diye array size print

  8. Array all data sum print – all data sum are print.

    Array Theory…@

  9. Array holo collection of variable of same data type. Onek gulo variableer collection ke array bola hoy.

  10. Int type er array er jonno sudhumattro int type variable gulo rakte parbo, string hole string type er variable rakhte hobe.

  11. Int [] number = new int[10];

Ekhane ami array te 10 ti value pass kore disi..

12. Declaring Array :

Int num = 10; Int[] num = new int[10] - Array declare . String[] names = new String[“Uzzal”]

13. Array index print :- Int[] num = new num[5];

Num[0] = 10; Num[1]= 20; Int length = num.length; System.out.println(length) // then array length

14. Array subtractor kora jai.:

Int sum = num[0]+num[1]; System.out.println(sum)

  1. Array size beshi nile problem nei , kintuo Jodi array er size kom nei r index Jodi beshi nei tahole array out of bound exception dibe.

  2. Int[] num = new int[10]; String[] name = new String [5];

Example:

  1. Array index print
  2. Array size
  3. Array Jogfol

package Java67Today;

public class Array {

public static void main(String args[]){ 
      int[] num = new int[5];  // array declear and create.//this is array size. 

     num[0] = 10; // this call of array index          num[1] = 15;          num[2] = 30;          num[3] = 45;          num[4] = 50; 

//array index print

     System.out.println("Index of four: "+num[3]); 

// array size print

             int length  = num.length; 
    System.out.println("Array of length: "+length);  

// array jogfol

    int sum = num[0] + num[1] + num[2] + num[3] + num[4]; 
    System.out.println("Array of sum : "+sum); 




} 

}

Array is important of all other Programming language. Below to many other’s picture to array.

The End of Tutoiral 20 Java Array Java 21 Tutorial Java Array and Avg

Java Array Finding Sum Avarage:- 52 num

Learn Array:-

  1. Array sum and average print kora.

  2. Array declear kore length er madhome call kora.

  3. Jotogulo num jog hobe thik sei gulo num diye vag korle average ber hoy. Say 5 ta num sum hose 5 num diye vag kore average ber korte hobe.

  4. Example num of Array,- length,sum , avg

package FeburaryJAVA;

import java.util.Scanner;

public class ArrayAditionAvg {

public static void main(String args []){ 


    Scanner sc = new Scanner(System.in); 
    System.out.println("Enter data num :- "); 

    double [] num = new double[5]; 

      // array length; 
    for (int i=0; i<num.length; i++){ 

        num[i] = sc.nextDouble(); 

    } 





    double sum = 0; 

   // array of add number 
    for (int i = 0; i<num.length; i++){ 

        sum = sum+num[i]; 
    } 

    //average num of:- 




    System.out.println("The array num of :" + sum); 
    System.out.println("The avarrage num of:"+sum/num.length); 
} 

// Scanner sc = new Scanner(System.in); // System.out.println("Enter data : ");

}

java array new Avearage and sum print:-

  1. Scanner class crate
  2. System, how many num ip user
  3. Array declare
  4. Index crate with input create

//How to use input in Array and 05 num .and check out average with sum /*

  1. scanner class

  2. want to num user 3.Array declare 4.index create with input create */

    // scanner class 
    Scanner sc = new Scanner(System.in); 
    
    //want to num user 
    System.out.println("Enter your 5 num"); 
    
    //array declare         int[] num = new int[5]; 
    

    //create index array

// num[0] = sc.nextInt(); // num[1] = sc.nextInt(); // num[2] = sc.nextInt(); // num[3] = sc.nextInt(); // num[4] = sc.nextInt();

// average and sun variable declare

     int sum = 0;         int avg = 0; 

    for (int i = 0; i<num.length; i++){ 

       num[i] = sc.nextInt(); 

        sum = sum+num[i]; 

        System.out.println("Sum of array : "+sum);         } 


    //average check out , divided to array lenght. 

    avg= sum/num.length; 
    System.out.println("Sum of average : "+avg); 

Tutorial 21 Now End.

If we want:- Int [] num = {10,20,30,40,5,20};

Tutorial 22

Java For Each Loop

  1. Array / collection er jonno forEach loop use kora hoy.

  2. Array declear kore for each loop er moddhe amara print korate pari.

  3. Fast – for keyword.

  4. Second – datatype and variable

  5. : (colone) keyword ti use koretee hobe.

  6. Je valur array rakha ase sei value ti dite hobe.

  7. For each loop er moddhe print korte hobe.

  8. Example : -
    Example:- String [] names = {"Anis sir", "Muzahidul islam ","Shafins", "doc Sunnil "};

for (String name : names){

System.out.println(name); } 
  1. Example:-
  2. int sum = 0; int num[] = {10,20,30,40,50,60,70,80,90};

for (int result : num){

System.out.println(result); 

sum = sum+result; 

}

System.out.println("sum = "+sum);

Tutorial 22 end now java for each loop

Tutorial num 23

-: Introduction to 2D array:

  1. Array 02 proker, One dimontional Array. Multi dimontional Array..

  2. Declaring 2d array int num [] [] = new int [2] [3] [2] – Row. [3] – Colum.

  3. Array initialize:--

  4. Array Introduction:-

  5. Declearing Array : -

Creating Array : -

     Array initialization:-  

Tutorial 23 – 2D Array completed . Now End .

Tutorial 24 Array MatriX : 01

  1. Declare two arry two matrix. 2.User input A, B 3.Show to the row column input line 4.Matrix A,b with subtraction..

// jva bangla Array mattrix part 1

// declare to Array two mattrix int [][] A = new int[2][3]; int [][] B = new int[2][3];

Scanner sc = new Scanner(System.in); System.out.print("Enter your data : ");

// user input to: A System.out.println("Enter element for A Mattrix: -"); for (int row =0; row<2; row++){

for (int col = 0; col<3; col++){ 

    //show to the row column in input line 
    System.out.printf("A[%d][%d]= ",row,col); 

    A[row][col] = sc.nextInt();     } 

}

// show this Display A

System.out.println("A :"); for (int row=0; row<2; row++){

for (int col =0; col<3; col++){ 


    System.out.print(" "+A[row][col]); 
} 

System.out.println( " "  ); 

}

System.out.println(" \n ");

// user input t B: System.out.println("Enter element for B Mattrix: -"); for (int row =0; row<2; row++){

for (int col =0; col<3; col++){ 

    //show to the row column in input line 
    System.out.printf("B[%d][%d] =  ",row,col); 

    B[row][col] = sc.nextInt(); 
} 

}

// println Matrix of B:- System.out.println("B: "); for (int row=0; row<2; row++){

for (int col = 0; col<3; col++){ 

    System.out.print(" "+B[row][col]); 
} 

System.out.println(" "); } 

--:Tutorial: 25 Array Matrix now End :--

Tutorial – 26 Array Matrix part -02 With subtraction.

//Array matrix with sub.....

//fast declare to array matrix int[][] A = new int[2][3]; int[][] B = new int[2][3]; int[][] C = new int[2][3];

Scanner sc = new Scanner(System.in); System.out.println("Enter input to Array Matrix elements ");

// user input to array matrix for A:- System.out.println("User input A :- "); for (int row = 0; row < 2; row++) { for (int col = 0; col < 3; col++) {

    //A in row col print 
    System.out.printf("A[%d][%d] = ",row,col); 

    A[row][col] = sc.nextInt(); 
} 

}

System.out.println("\n");

// user input to array matrix for B:- System.out.println("User input B:- "); for (int row = 0; row < 2; row++) {

for (int col = 0; col < 3; col++) { 

    System.out.printf("B[%d][%d] = ",row, col); 

    B[row][col] = sc.nextInt(); 
} 

}

// Array matrix to show the Display:- A

System.out.print("A:"); for (int row = 0; row < 2; row++) {

for (int col = 0; col < 3; col++) { 

    System.out.print("\t" + A[row][col]); 
} 


System.out.println(); 

}

System.out.println("\n");

// Array matrix to show the Display:- B

System.out.print("B:"); for (int row = 0; row < 2; row++) {

for (int col = 0; col < 3; col++) { 

    System.out.print("\t" + B[row][col]); 
} 


System.out.println(); 

}

//Array matrix to sum print in show line... System.out.println("Array matrix are print subtraction: - "); System.out.println("Aray of sub - A+B: - "); for (int row=0; row<2; row++){

for (int col=0; col<3; col++){ 

    C[row][col] = A[row][col]+B[row][col]; 
    System.out.print("\t"+C[row][col]); 
} 

System.out.println(); 

}

Tutorial 26: now end ..
Java Array Matrix part 2 printed.

Tutorial num : 27 Sum Of Diagonal, Upper, Triangle, and Lower.

Diagonal – 1+5+9 is Diagonal elements.

Row and column same its call diagonal.

If(row==col) Upper triangle – Di agonal elements er upore, 2+3+6 = 11

Row er cheye column er index boro..

If(row<col) Lower Triangle- Daiagonal elements er nise lower Traiangle elements. 4+7+8 = 19.

row er cheye column er index soto. if (row>col)

Example: -
public static void main(String args[]) {

    // row and col same its cal diagonal. 


   //diagonal , uppper, lower case.. 
    Scanner sc = new Scanner(System.in); 
    System.out.println("Enter your num : - "); 



    // fast array create... 
    int [][] A = new int[3][3]; 

    //user input to array create.         for (int row = 0; row<3; row++){ 

        for (int col = 0; col<3; col++){ 

            //user input.. 
            A[row][col] = sc.nextInt(); 
        } 
    } 



    // initilize the diagonal, lower and upper 

    int diagonal = 0;         int upper = 0;         int lower = 0; 

    //diagonal , upper , lower case 

    for (int row=0; row<3; row++){ 

        for (int col =0; col<3; col++){ 

            // row and col same its cal diagonal.                 if (row==col){ 

                diagonal = diagonal+A[row][col]; 
            } 


            //row er cheye column er index boro  - upper 
            if (row<col){ 
                upper = upper+A[row][col]; 

            } 

            //row er cheye column er index soto - lower. 
            if (row>col){ 
                lower = lower+A[row][col]; 

            } 
        } 
    } 

 System.out.println("Daigonal : "+diagonal); 
 System.out.println("upper : "+upper); 
 System.out.println("lower : "+lower); 




} 

}

Tutorial No 28 Array Output part – 01 Output:
0 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 Learn array: 1.Every value to 1, just create a initialize. 2. create to array 2 dimontional 4 row and 5 column. 3.Asigning value 2 array. 4. printing the elements row and column

// Array row column print..

//every value step to 1 just create a initlize. int k = 0;

//create to array 2 dimontinal 4 row and 5 column int [][] num = new int[4][5];

//crate iteratin loop in 4 row, 5 column //asigning to the value in 2d array ... for (int i=0; i<4; i++){

  for (int j =0; j<5; j++){ 

      num[i][j] = k;           k++; 

  } 

}

//printing the elements.. //2D array printing to row, column for (int i= 0; i<4; i++){ for (int j=0; j<5; j++){

      // here is print num and row. 
      System.out.print("\t"+num[i][j]); 
  } 

  System.out.println();   } 

Tutorial No 29: Part:- 02

  1. 2Daimontional array first check out row and column .
  2. Row declare must but column doesn’t declare no problem.
  3. Ouptpu:
    0
    1 2
    3 4 5
    6 7 8 9 // Array row column print..in 2D Diamontional new print..

//initilize array create just row, not column int [][] num = new int[4][];

//first row column declare.. // 0 num row a column thakbe 1 ta. // 1 num row a column thakbe 2 ta.

//row er under a column create, row num[0] a akta column new int[1]; create korlam.

num[0] = new int[1]; num[1] = new int[2]; num[2] = new int[3]; num[3] = new int[4];

//initlize the value.

int k = 0;
//create row with every looping 1 add to column with asign to num.. for (int i =0; i<4; i++){

for (int j =0; j<i+1; j++){ 

    // num asign korte hobe 1 , 1 kore barate hobe. 

    num[i][j] = k;         k++; 
} 

}

// display show this array now...

for (int i=0; i<4; i++){

for (int j=0; j<i+1; j++){ 

    System.out.print(num[i][j]+" "); 
} 

System.out.println(); 

}

Tutorial 29 is now end.

Tutorial No: 30

Sorting An Array

Array ascending / Descending:-

// sorting on array with print array max with min num.

// array declare int [] num = {10,-3,25,1,30};

// how to crate ascending or descending // at first call in Arrays.sort() method. //create to arrays sort method .

Arrays.sort(num);

System.out.print("Asecending:- "); for (int i =0; i<5; i++){

  //Array ascending 

  System.out.print(" "+num[i]); 

}

System.out.println();

System.out.print("Descending:- "); for (int i =4; i>=0; i--){

  System.out.print(" "+num[i]);   } 

The Tutorial end of Soritn an array.. Tutorial end Num of 30 Complete in Array.

Tutorial:- 31 Array List in Java..

Array:-

  1. Array is static .

  2. Static thatmeans size fixed. Next ami change korte parbona.

  3. Array size fixed thake.

Array List:-

1.ArrayList Dynamic.

2.ArrayList er size fixed noy, eta dynamic. Eta ami change korte parbo.

  1. Primary point ami jotogulo element add korte saiboo ArrayList a add korte parbo.

Array List declare :

ArrayList number = new ArrayList(); ();- er moddhe size esse moton nite parbo.. ei jonno amra size nissina..

// if i print to array size.. System.out.println("Array size = "+num.size());

Example : ArrayList Part : 01 ArrayList:

1.ArrayList create = ArrayList

2.Array size. = num.size();

  1. Array add = num.add();

  2. Array index display to show= num

5.display to many other Array = for each loop();

  1. for loop to – iterator method declare.

  2. removing element to aray index – num.remove();

  3. all elements are removing aray - num.remove(num);

  4. clear method call – num.clear();

    // ArrayList create. ArrayList num = new ArrayList(); //size. // I don't size declare . I wish that get a size.

    // if i print to array size.. System.out.println("Array size = "+num.size());

    // we are display to show many other's things  :01 
    
    
    
    
    /* how to adding to array elements method call to num. add().. 
     with hoe to removing array elements method call to num.. rem(); */ 
     num.add(10);  // array idex 0 and num 10         num.add(12);  // array idex 1 and num 12         num.add(15);  // array idex 2 and num 15 
    
    num.add(3,100); // array index 4, element 100; 
    

    // array index display show in print System.out.println(num);

    // size print of array.. System.out.println("Array size = "+num.size());

    // we are display to show many other's things  :-
    

02 // use to for each loop

    for (int res : num){ 

        System.out.println("for each loop : "+res);         } 

    System.out.println("Array size: "+num.size());  

    System.out.println("Array List Add to 

Contains:"+num);

    // iterator method to crate a for loop print now. system in:  03 

   // Iterator itr= num.iterator(); //arraylist er madhome iterator method k use korbo. 




    //then help to while loop and calling to hashnext method. 
    //when valu select to hasNext method create. 

// while (itr.hasNext()){ // // //itr er every value want to print. // System.out.println("every itr value:" + itr.hasNext()); // }

    //removing element to Array list in Array 

    num.remove(0); 
    System.out.println("Array List remove to 

Contains:"+num);

    //all array list are remove in remove(); 

// num.remove(num); // System.out.println("Array List all Remove Contains:"+num);

Tutorial – 33 Array List Part : 02

// basic ArrayList in java /*ArrayList

  • create-ArrayList num=new ArrayList();

  • size output- num.size

  • elements add – num.add * print and contains- num.contains(30)- Boolean return.

  • size

  • remove – num.remove(2); - index

  • all size of remove – num.remove();

  • Clear method – num.clear(); * isEmpty - if any value storage return false, any value null retrun true,

  • ArrayList contains - ArrayList er size a 30 value thakle true, na thakle false.

  • set method - Arralist in any index set of value, that means replace method.

  • get method – index er value pabo.

  • */

ArrayList num = new

ArrayList(); //if any value don't storage, there is no problem show in ArrayList.

//size output:- System.out.println("ArrayList size: "+num.size());

//arrayList elements add num.add(0, 10); num.add(1, 20); num.add(2, 30); num.add(3, 40); num.add(4, 50);

//arraylist size. System.out.println("Array List size :- " + num.size());

//all arrayList print and contains print.

System.out.println("Array List contains : " + num); //isEmpty(); /* ArrayList empty return true, ArrayList any value storage return false*/ boolean con = num.isEmpty(); System.out.println("condition is empty method: "+con);

//set method

num.set(3,100); // replace System.out.println("Seeter method , replace call : "+num);

//get method();

int gets = num.get(0); // get in method. System.out.println("Index of 0 :- "+gets);

//indexOf();

int indexpos = num.indexOf(30); System.out.println("Index of ArrayList
: "+indexpos);

//contains method

/*list in storage if any element are return true , other return false. */ boolean cont = num.contains(30); System.out.println("30 is in the line:- "+cont);

//arrayList remove index. num.remove(num.remove(1));

System.out.println("ArrayList remove index :- " + num);

//arrayList remove all num.removeAll(num);

System.out.println("ArrayList Remove all : " + num);

//arrayListClear num.clear();

System.out.println("After clear Array: "+num);

Tutorial -34 ArrayList part : - 03

/*

  • use to add method.
  • use to addAll();
  • use to equal method . - if any method equal , equal - retutrn boolean value true, other wise false. * */

ArrayList num1 = new ArrayList<>(); ArrayList num2 = new ArrayList<>(); ArrayList num3 = new ArrayList<>();

// add method call num1 num1.add(10); num1.add(20); num1.add(30); num1.add(40); num1.add(50); System.out.println("Add method : "+num1);

// add method call num1 num2.add(60); num2.add(70); num2.add(80); num2.add(90); num2.add(100); System.out.println("Add method : "+num2);

// num3 and num1 similar to print create to.. addAll(); num3.addAll(num1); System.out.println("all method are print: "+num3);

//equal mehtod create to boolean result, either true are false. boolean res = num1.equals(num2); System.out.println("Num1 = Num2 : "+res); boolean result = num1.equals(num3); System.out.println("num1 == num3: "+result);

Tutorial – 3 6 Sorting an ArrrayList

If any num smaller to bigger or bigger to smaller show in program.- this is call sorting.

That’s means – ascending or descending.

// Sorting an arrayList

/*hoy soto theke boro othoba boro theke soto num a sajano thakbee

  • That's means ascending or descending

  • collections.sort(); - ascending

  • Collections.sort(num, Collections.reverseOrder()); - descending Collections.sort method call then arralist pass then Colletions.reverseOrder ei method ti call hobe - * */

//arrayList create. ArrayList num = new ArrayList<>();

//arrayList add num.add(10); num.add(- 20); num.add(30); num.add(40); num.add(50);

System.out.println("before sorting : "+num);

//ascending sorting area call of

collections.sort(); Collections.sort(num); System.out.println("Ascending sorting : "+num);

// reverse korlei descending. Collections.sort(num,

Collections.reverseOrder()); System.out.println("Descending sorting "+num);

Tutorial – 37 Java Bangla Tutorial String

String – String that’s means object. Sequence of char

in java programming

/* String makes for 3 class

1.String 2.String Buffer 3.String Builder

  1. char type Array calls are String.
  2. value string - String name = "uzzal"; 6.object string - String n = new String (" Uzzal"); 7.char type array ke string bola hoy - char [] name = {'a','b'}

Some known to method String.

8.length(); - coName.length();

9.coName , obj jodi akoi hoy tahole 3 system ase print kora jabe..

//compareTo, equals, == ; //

coName and obj ke reference bola hoy refernce gulo akoi na tai not equal print hobe.

10.equalS();- coName.equals() - value compare korte hobe equal mehtod er moadhhome.

  1. contains method call korbo. kaj holo coName er moddhe obj er kisu ase kina jodi thake true return korbe.

  2. equalsIgnoreCase() call some data are ignoe. upper case lower case ignore korbe.

  3. contains mehtod coName er moddhe Techoners thake tahole return korbe true r ta na hole false. boolean res = coName.contains("Techoners");

14.// is empty (); //coName - if any data sotrage return false, don't data storage return true. */

// value string

String coName = "Techoners Wordpress"; System.out.println("valu Stirng : -"

  • coName);

//object string

String obj = new String("Techoners Wordpress"); System.out.println("Object Stirng : -" + obj);

//char type array ke string bola hoy char[] name = {'u','z','z','a','l'}; System.out.println(name);

// some knwon to method String ..

// string length int len = coName.length(); System.out.println("String length : "+len);

// coName , obj jodi akoi hoy tahole 3 system ase print korar..

//compareTo, equals, == ;

// coName and obj ke reference bola hoy refernce gulo akoi na tai not equal print hobe.

if (coName==obj){

  System.out.println("Equals"); 

}else{

  System.out.println("Not 

Equals"); }

//value compare korte hobe.. equals() - ei mehtod er maddhome..

if (coName.equals(obj)){

  System.out.println("Equals"); 

}else{

  System.out.println("not 

Equals"); }

// contains method call korbe. // kaj holo coName er moddhe obj er kisu ase kina jodi thake true return korbe.

if (coName.contains(obj)){

  System.out.println("Correct contains");   }else {       System.out.println("Incorrect contains"); 

}

//equalsIgnoreCase() call some data are ignoe. upper case lower case ignore korbe.

if (coName.equalsIgnoreCase(obj)){

  System.out.println("Ignore Case 

"); }else{

  System.out.println("Not Ignore case "); 

}

//contains mehtod // coName er moddhe Techoners thake tahole return korbe true r ta na hole false. boolean res = coName.contains("Techoners"); System.out.println("Contains method: "+res);

// is empty (); //coName - if any data sotrage return false, don't data storage return true. boolean ie = coName.isEmpty(); System.out.println("if any data sotrage: - "+ie);

End of java String part 1.

Tutorial No :- 38 Java String part : 02

// String part 2: /*

  • String er maddhome jog possible.. * concat(); - concat method er o jog possible *toUpperCase(); - upper case er

madhome sob kisu boro hobe.. *toLowerCase(); - lower case er madhome sob kisu soto hobe.. * startWith(); - first word capital hole / or same word then true, r ta na hole false

  • endsWith(); - lettr jodi matched hoy true then other wise return false. * String array declare and for each loop use - name[i]
  • */

// String er madhome jog possible..

String firstName = "Uzzal"; String lastName = " Mondal";

String name = firstName + lastName; System.out.println(name);

System.out.println();

// String er madhome Concat possible.. //concat(); String resname = firstName.concat(lastName); System.out.println(resname);

System.out.println();

//String er full name ti puropuri upper case korbo.. //resname.toUpperCase(); String upper = resname.toUpperCase(); System.out.println(upper);

System.out.println();

//String er full nate ti puropuri lower case korbo... //resname.toLowerCase(); String lower = resname.toLowerCase(); System.out.println(lower);

System.out.println();

//String er value startWith (); - fast word capital hole true na hole false return. //startWith(); boolean b= firstName.startsWith("U"); System.out.println(b);

System.out.println(); //String er value startWith (); - word don't match return false. //startWith(); boolean bRes= firstName.startsWith("u"); System.out.println(bRes);

System.out.println(); //String er value endsWith (); - last word match //endsWith(); boolean lname = lastName.endsWith("l"); System.out.println(lname);

//String array

String [] names = {"Shuvash", "Shaptami","uzzal","suzal","Mondira"};

for (int i = 0; i<5; i++){

System.out.print(names[i]); 

}

System.out.println("forseach");

for (String allName : names){

System.out.print(","+allName); 

}

Tutorial 40 Java String part – 3

trim(); - samne and pise se jaiga remove korbe but middle point a noy. chartAt(0) – 0 index er char find korte parbo. codePointAt(0) – 0 index er asci value return korbe.

indexOf(‘n’) – n er index/pos num ta bole dibe lastIndexOf(‘n’) – last er index/pos num ta bolbe.

String name = " Techoners is well for Web Development ";

//trim();

String t = name.trim(); System.out.println(t);

#// chartAt(0); // 0 index er char ti find korbe. char n = name.charAt(0); System.out.println(n);

System.out.println();

// codePointAt(0)

//0 index er asci value return korbe. int a = name.codePointAt(0); System.out.println(a);

System.out.println(); //indexOf(‘e’) – e er index/pos num ta bole dibe int m = name.indexOf('e'); System.out.println(m);

//lastIndexOf(‘e’)

//last er index/pos num ta bolbe. int e = name.lastIndexOf('e'); System.out.println(e);

/*

  • replace(); - 2 ta paramiter chai i place j include korle j all times print hobe i er khane.

  • split(); - akta string ke onek vabe bivokto korte parboo..

  • then return korbe akta string[] - string array. *

  • */

String s1 = "Techoners is my favourite place"; System.out.println(s1);

//replace(); String a = s1.replace("o","r"); System.out.println(a);

//split(); - string er moddhe jeta pass seta remove hoye jabe // return korbe string[] String sp = "hello, I am including in Techoners, I hope its my pleasure"; String[] spl = sp.split(",");

for (String res : spl){

 System.out.println(res); 

}

Tutorial 41 String Buffer

  1. String is not changeable. With , object k niye j kono akta value , datatype er moddhe rakhte hoy. then print korte hoy.

  2. Example: String name = “uzzal”; String std = name.replace(z,j); Ekhane std er moddhe value change kora jabena.

  3. String Buffer is changeable,
    Create:- StringBuffer sb = new StringBuffer(“uzzal”) Ekhane sb object niye sob value print kora jabe..

  4. StringBuffer sb = new StringBuffer("Uzzal Mondal");

  5. String there is no change, but String Buffer is changeable.

  6. String buffer and string add

  7. appeand() - int / string sob value kaj kora jabe..

  8. delete() - ei index theke oi index delete 0,4

  9. length() - seLength - how many length told cm

  10. reverse() - ultano print hobe

    //String add

    String cName = "Techoners is my best place "; 
    
    StringBuffer sb = new StringBuffer(cName); 
    

// just print

    System.out.println(sb); 

//flexiable method();

    // onno datatype  er sathe kaj kore..         //string 
    sb.append("Thank's to chance in you place "); 
    //int         sb.append(10); 
    System.out.println(sb); 

// delete

    // 0 index theke koto index porjonto delete  seta bolte hobe         sb.delete(0,4); 
    System.out.println(sb); 

//length sb.setLength(10);

    System.out.println(sb); 

// reverse sb.reverse();

    System.out.println(sb); Tutorial  42 

String : palindrome

String er moddhe value nibo. String s = “madam”;

StringBuffer sb = new StringBuffer(s);

sb.reverse();

akta String variable er vitore jokon rakhbo tokon , String variable a StringBuffer er value rakhte dibona. E jonno amake jeta use korte hobe seta holo toString();

if-else condition chalabo, equals(); method er maddhome. Palindrome check Example:

/* Stirng delcare

     StringBuffer Declare 

     reverse(). method call and String buffer er value string er moddhe rakhte parbona          tai amara toString method call korbo. 

check to palindrome in reverse method..

    */ 

    String name = "1221"; 


   //String buffer declare 
   StringBuffer sb = new StringBuffer(name); 



    /*reverse(). method call and String buffer er value string er moddhe rakhte parbona         tai amara toString method call korbo.*/ 
  String res =       sb.reverse().toString(); 


  // check to palindrome in reverse metho 

if (res.equals(name)){

System.out.println("Palindrome"); 

  }else{ 

System.out.println("not plaindrome"); }

Tutorial - 43 StringBuilder

  1. Stirng builder er subidha eta akti change able.
  2. appeand(); - int,string,char, double sob gulo value call korte pari.

/*

  StringBuilder... 
  appeand() - int, double, String all datatype value we want to call it. 

  StringBuffer er moton all method supported. 

  reverse() - 

  */ 

  String name = "techoners";       StringBuilder sb = new StringBuilder(name); 

  System.out.println(" range : "+sb); 


  //apeand();       sb.append(" mondal,");       sb.append(10+",");       sb.append(12.10); 
  System.out.println(sb); 


  //reverse(); 
   String rv =  sb.reverse().toString();         System.out.println("Reverse : "+rv); 

    //delete 
    String dl = sb.delete(0,6).toString(); 
    System.out.println(dl); 

Tutorial 44 Wrapper class

//Java wraper class:--

    /* 
  1. java oop language , eta object use niye kaj kore..

  2. java te sobgulo object niye kaj korbe.

  3. primitive datatype to object convert.

  4. Object to primitive datatype convert.

  5. we try to know that, wrapper class, autoboxing, outboxing

6.autoboxing - primitive data type theke jokon object a jabo tokon-> autoboxing.

7.outboxing - object theke jokon primitive data type a jabo tokon-> outboxing.

  1. j class er name sei class er value likte hobe
  2. Double y = Double.valueOf(x); */

// primitive to convert -> object with call> autoboxing.

    //valueOf();         int x = 30; 
    Integer y = Integer.valueOf(x); 
    System.out.println(y); 

//method don't declare to work //automatic primitive to obj -> call of autoboxing int z = x; System.out.println(z);

// Object to -> primitive datatype ->Outboxing Double d = new Double(10.26); System.out.println(d); //outboxing double e = d.doubleValue(); System.out.println("double value "+e);

    //don't decalre to doubleValue();         double de = e; 
    System.out.println(de); 

Important Tutorial : 45 Primitive to String String to Primitive

Primitive to Stirng:

/*

  1. primitive to Stiring .

  2. String to primitive.

    */ 
    
    
    // primitive to String.         int x = 10; 
    
    // String a convert korar jonno amara toString();  method call korbo., 
    String s = Integer.toString(x); 
    System.out.println(s); 
    
    
    //primitive double to convert to string         double i = 20; 
    String res = Double.toString(i); 
    System.out.println(res); 
    

//primitive float to convert String float f = 12.12f; String fl = Float.toString(f); System.out.println(fl);

    //primitive char to Convert String         char c = 'a'; 
    String ch = Character.toString(c); 
    System.out.println(ch); 


    //primitive byte to String         byte b = 2; 

String bt = Byte.toString(b); System.out.println(bt);

    //primitive short to string convert         short sh = 5; 
    String st = Short.toString(sh); 
    System.out.println(st); 


    //primitive long to Stirng convert         long l = 120L; 
    String ln = Long.toString(l); 
    System.out.println(ln); 

//primitive boolean to Stirng convert.. boolean bl = true; String bla = Boolean.toString(bl); System.out.println(bl);

String to primitive:-- /* primitive to Stirng convert -> to String method; String to primitive convert -> parseInt(), parseDouble(); value of(); */

      //String to primitive 


     // Integer.parseInt(); 

String s = "32"; int nm = Integer.parseInt(s); System.out.println(nm);

    //double 
    String cm = "25"; 
    double db = Double.parseDouble(cm); 
    System.out.println(db); 

    //float 
    String f = "20.56";         float fl = Float.parseFloat(f); System.out.println(fl); 

Tutorial : 46 Binary, Octal, Hexadecimal convert to-> Decimal..##

    //binary to decimal format 
    String bin  = "1010"; 
    Integer  decimal = 

Integer.parseInt(bin,2); System.out.println("Decimal "+decimal);

//octal to decimal format String oc = "101011"; Integer ot = Integer.parseInt(oc,8); System.out.println("octal " + ot);

    //hexadecimal to decimal format 
    String hex = "A"; 
    Integer hd = Integer.parseInt(hex,16); 
    System.out.println("hexa decimal " 

+hd);

Tutorial - 47 convert decimal into binary, octal, hexadecimal number.

    // decimal to binary. 
    // toBinaryStirng(); -> return korbe akta string.. 
    int decimal = 15; 
    String binary =   

Integer.toBinaryString(decimal); System.out.println("Binary num : - "+binary);

    //decimal to octal 
    Scanner sc = new Scanner(System.in); 
    System.out.println("Enter Octal num input: - "); 
    int decimall = sc.nextInt(); 

String octal = Integer.toOctalString(decimall); System.out.println("Octal : "+octal);

    // decimal to hexadecimal num         int dec = 15; 
    String hex  = Integer.toHexString(dec); 
    System.out.println("hexa decimal num 

:- "+hex);

Tutorial -48 Date & Time

    // current date show .. 
    Date  date = new Date(); 
    System.out.println(date); 


    //Date format.. 
    DateFormat df = new 

SimpleDateFormat("dd/MM/YYYY"); String currentDate = df.format(date); System.out.println("current date : "+currentDate);

    // Time 
    //localtTime.now() 
    LocalTime time = LocalTime.now();         System.out.println("local time "+time); 

     
     
    //format time.. 
    DateTimeFormatter dtf = 

DateTimeFormatter.ofPattern("hh:mm:ss"); String formatedTime = time.format(dtf); System.out.println("Time "+formatedTime);

About

JavaBasicProblemSolving


Languages

Language:Java 96.2%Language:Kotlin 3.8%