Snippets Collections
/*
printf(String format, [value,...])
Format: %-,X.Yf

Always starts with %
-Causes the value to be left justified.  Otherwise it is right justified
A comma causes commas to be displated in the printed number
X = field width
Y is number of digits after the decimal point
f is format type: d = integer (int), f = floating point number (double), s = string
*/

//EXAMPLE
int x = 123, y = 46789;
double a = 3.14159265, b = 2.7182818;
String first = "Wilma", last = "Flintstone";
System.out.printf("%6d %-,d\n", x, y); //Punctuation counts towards spaces
System.out.printf("%5.2f %-7.4\n", a, b);
System.out.printf("first = [%s] last = [%12s]\n", first, last);

/*
Prints as :
___123 456,789_
_3.14 2.7183_
First = [Wilma] last = [__Flinststone]
*/


//Example
import java.io.File;
import java.io.FileNotFoundException;
import java.io.PrintWriter;
import java.util.Scanner;

/* 
Contents of scores-in.txt:
80 90 70
40 60 80
100 93 87
*/

public class ExamAvg {
  public static void main(String[] args) throws FileNotFoundException {
    //open "scores-in.txt" fore reading
    scanner in = new Scanner(new FIle("scores-in.txt"));
    //open "scores-out.txt" for writing
    PrintWriter out = newe PrintWriter(new File("scores-out.txt"));
    //Print the column headers
    out.println("Exam 1  Exam 2  Exam 3  Exam Avg");
    out.println("------  ------  ------  --------");
    //Read teh exam scores form "score-in.txt", calculate the exam average, and print the formatted output to the output fle
    while(in.hasNext()){
      int e1 = in.nextInt();
      int e2 = in.nextint();
      int e3 = in.nextint();
      double avg = (e1 + e2 + e3) / 3.0;
      out.printf("%6d %6d %6d %8.1f\n", e1, e2, e3, avg);
    }
    //Close the input file
    in.close;
    //close the output file
    out.close;
  }
}




//Construct a java.io.File object and pass the file anme as an argument
import java.io.File;
import java.io.PrintWriter;

String fname = "output.txt";

File file = new File(fname);

//Then pass the file object as an argument to the java.io.PrintWriter class
PrintWriter out = new PrintWriter(file);

//They can be combined together
PrintWriter out = new PrintWriter(new File(fname));

//EXAMPLE

int x = 20;
double y = 3.14159265;
char ch1 = '$', ch2 = 'A';
String s1 = "Fred", s2 = "Flintstone";
PrintWriter out = PrintWriter(new File("output.txt")); //opens a file for writing
out.print(x + " " + y); 
out.println(ch1);
out.println(ch2 + " " + s2 + ", " + s1);
out.close;

/* 
OUTPUT:
20 3.14159265
$
A Flintstone, Fred
*/
/* 
TXT file contains these characters:
Pebbles Flintstone\n
1 2.2\n
This is a line of text.\n
*/

import java.io.File;
import hava.util.Scanner;

Scanner scanner = new Scanner(new File("input.txt"));
String s1 = scanner.next();  //s1 is assigned "Pebbles"
String s2 = scanner.next(); // s2 is assigned "Flintstone"
int x = scanner.nextInt(); // x is assigned 1
double y = scanner.nextDouble(); // y is assigned 2.2
scanner nextLine(); //Advances scanner to beginning of next line
String s3 = scanner.nextLine(); // s3 is assigned "This is a line of text"
scanner.close();
void close() //must be called when finished reading from file
boolean hasNext() //returns true If there are more characters to be read from the file
String next() //skips whitespace until a nonwhitespace character is found and then reads characters until a whitespace character is encountered
double nextDouble() //Scans the next token assuming it is a real number
int nextInt() //Scans the next token assuming it is an integer
String nextLine() //Reads and returns all characters on the current line.  After reading , the scanner will be pointing to the next character of the next line of text
Import java.io.File;
Import java.io.FileNotFoundException;
Import java.io.PrintWriter;
Import java.lang.Integer;
Import java.util.ArrayList;
Import java.util.Scanner;

//Reads a file named "ints-in.txt" containing integers and writes the integers to "ints-out.txt" in reverse order.

Class PrintReverse {
	Public static void main (String[] args) throws FileNotFoundException {
		//Create an ArrayList of Integers
		ArrayList<Integer> list = new ArrayList<>();
		Scanner scanner = new Scanner(new File("ints-in.txt"));
		while(scanner.hasNext()){
			list.add(scanner.nextInt());
		}
		scanner.close();
		
		PrintWriter out = new PrintWriter(new File("ints-out.txt"));
		for (int I = list.size()-1; I >= 0; --i){
			out.println(list.get(i));
		}
		out.close();
	}
}
import java.util.ArrayList;
ArrayList<String> names = new ArrayList<>();
names.add("Emily");
names.add("Bob");
names.add("Cindy");

int n = names.size();  // Returns n = 3
String s = names.get(0); //Assigns "Emily" to s
String s = names.set(2, "Carolyn"); //Assigns "Cindy" to s, since it was the value that was replaced

Names.add(1, "Ann"); //inserts the element at the given index.  The index shifts to add the given element
String S = names.remove(1); //Removes element at given index.  Element is saved as s.

for (int I = 0; I < names.size(); ++i){
	System.out.println(names.get(i));
}

for (String name : names){
	System.out.println(name); //Enhanced For Loop
}
import android.content.Context;
import android.os.Build;
import android.view.LayoutInflater;
import android.view.View;
import android.view.ViewGroup;
import android.widget.TextView;
import androidx.annotation.RequiresApi;
import androidx.recyclerview.widget.RecyclerView;
import java.util.ArrayList;


public class Adapter extends RecyclerView.Adapter<Adapter.MyViewHolder> {

    private ArrayList<String> arraylist;
    Context context;
    private MyInterface myInterface;


    public Adapter(Context context, ArrayList<String> arraylist) {
        this.context = context;
        this.arraylist = arraylist;
    }

    public class MyViewHolder extends RecyclerView.ViewHolder implements View.OnClickListener {
        public TextView tvView;

        public MyViewHolder(View view) {
            super(view);
            tvView = view.findViewById(R.id.tvView);
            tvView.setOnClickListener(this);
        }

        @Override
        public void onClick(View view) {
            if (myInterface != null) myInterface.onItemClick(view, getAdapterPosition());
        }
    }

    @Override
    public MyViewHolder onCreateViewHolder(ViewGroup parent, int viewType) {
        View itemView = LayoutInflater.from(parent.getContext()).inflate(R.layout.row, parent, false);
        return new MyViewHolder(itemView);
    }

    @RequiresApi(api = Build.VERSION_CODES.LOLLIPOP)
    @Override
    public void onBindViewHolder(final MyViewHolder holder, int position) {
//        holder.tvView.
    }

    @Override
    public int getItemCount() {
        return arraylist.size();
    }

    public void setClickListener(MyInterface itemClickListener) {
        this.myInterface = itemClickListener;
    }

    public interface MyInterface {
        void onItemClick(View view, int position);
    }

}
#include "Arduino.h"
#include "SoftwareSerial.h"
#include "DFRobotDFPlayerMini.h"
#include <Adafruit_NeoPixel.h>
#include <Servo.h>

// sensors
#define LDR0pin A0 
#define LDR1pin A1 
#define LDR2pin A2 
#define LDR3pin A3 
#define LDR4pin A4 

// servos/motors
#define boo1pin 2
#define boo2pin 3
#define ceilingpin 4

// gun
#define buttpin 5
#define indipin 6
#define laserpin 7

// LEDs
#define melodypin 8
#define mompin 9
#define DATA_PIN 10 
#define NUM_LEDS 20 

// DFPlayer
SoftwareSerial mySoftwareSerial(12, 13); // TX, RX
DFRobotDFPlayerMini myDFPlayer;

// led strips
Adafruit_NeoPixel lightning_strip = Adafruit_NeoPixel(NUM_LEDS, DATA_PIN, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel melody = Adafruit_NeoPixel(2, melodypin, NEO_GRB + NEO_KHZ800);
Adafruit_NeoPixel mom = Adafruit_NeoPixel(2, mompin, NEO_GRB + NEO_KHZ800);

// servos
// twelve servo objects can be created on most boards
Servo servo0;  // create servo1 object to control a servo1
Servo servo1;
Servo servo2;

// ADJUST FOR LIGHT THRESHOLDS
short laserThresh = 240;
short altThresh = 255;

// lightning
unsigned long flickerTime = 0, fadeInTime = 0;
byte i = 6, lowBright = 10, highBright = 255;
boolean lightState = true;

// boo servos
unsigned long booTime = 0;
boolean booState = false;

// mom, melody, ceiling trigger times
unsigned long momTime = 0, melodyTime = 0, ceilingTime = 0;

 // used for debouncing button
unsigned long lastDebounceTime = 0, highTime = 1, lasthighTime = 0;
byte buttonState, lastButtonState = HIGH;
boolean adjust = true;

// sensors
byte LDR0 = 0, LDR1 = 0, LDR2 = 0, LDR3 = 0, LDR4 = 0, LDR5 = 0;

void setup() {
  lightning_strip.begin();
  lightning_strip.setBrightness(lowBright);
  setLightning(0,255,0);

  melody.begin();
  melody.setBrightness(100);
  setMelody(0,0,0);

  mom.begin();
  mom.setBrightness(100);
  setMom(0,0,0);
  
  mySoftwareSerial.begin(9600);
  Serial.begin(9600);
  
  Serial.println();
  Serial.println(F("DFRobot DFPlayer Mini Demo"));
  Serial.println(F("Initializing DFPlayer ... (May take 3~5 seconds)"));
  
  if (!myDFPlayer.begin(mySoftwareSerial)) {  //Use softwareSerial to communicate with mp3.
    Serial.println(F("Unable to begin:"));
    Serial.println(F("1.Please recheck the connection!"));
    Serial.println(F("2.Please insert the SD card!"));
    while(true);
  }
  Serial.println(F("DFPlayer Mini online."));

  // CHANGE TO 20
  myDFPlayer.volume(30);  //Set volume value (0~30).

  // gun
  pinMode(laserpin, OUTPUT);
  pinMode(indipin, OUTPUT);
  pinMode(buttpin, INPUT_PULLUP);

  // sensors
  pinMode(LDR0pin, INPUT);
  pinMode(LDR1pin, INPUT);
  pinMode(LDR2pin, INPUT);
  pinMode(LDR3pin, INPUT);
  pinMode(LDR4pin, INPUT);

  // servos
  
  servo0.attach(boo1pin);
  servo1.attach(boo2pin);  // attaches the servo1 on pin 9 to the servo1 object
  servo2.attach(ceilingpin);

  // initialize servo positions:
  servo0.write(40); // boo1 swivels out RIGHT
  servo1.write(40); // boo2 swivels out LEFT
  servo2.write(90); // ceiling starts horizontal

  // opening song
  myDFPlayer.playMp3Folder(0);
}

void loop() {
  LDR0 = analogRead(LDR0pin);
  LDR1 = analogRead(LDR1pin);
  LDR2 = analogRead(LDR2pin);
  LDR3 = analogRead(LDR3pin);
  LDR4 = analogRead(LDR4pin);

  //trigger(trig_time, reload_time);
  //default (250, 1000)
  trigger(250, 1000);

  // boo(toggle_interval
  boo(2000);

  //lightning(flickerRate, blackout_time);
  lightning(150, 3000);
  lightning_strip.show();
  Serial.println(LDR4);

  //targetHit(playTime)
  melodyHit(4000);
  momHit(5500);
  ceiling(3000);
}

void ceiling (short playTime) {
  if (LDR4 > laserThresh) {
     ceilingTime = millis();
     myDFPlayer.playMp3Folder(4);
  }
  
  if (millis() - ceilingTime < playTime) servo2.write(0);
  else servo2.write(90);
}

void melodyHit (short playTime) {
  // if target hit, reset routine
  if (LDR2 > laserThresh) {
    melodyTime = millis();
    myDFPlayer.playMp3Folder(2);
  }

  if ((millis() - melodyTime < playTime)&&(melodyTime > 0)) setMelody(128, 0, 128);
  else setMelody(0, 0, 0);
}

void momHit (short playTime) {
  // if target hit, reset routine
  if (LDR3 > laserThresh) {
    momTime = millis();
    myDFPlayer.playMp3Folder(3);
  }

  if ((millis() - momTime < playTime)&&(momTime > 0)) setMom(128, 0, 128);
  else setMom(0, 0, 0);
}

void boo (short toggle_interval) {
  if (millis() - booTime > toggle_interval) {
    booState = !booState;
    booTime = millis();
  }
  
  if (booState)  {
    servo0.write(40);
    servo1.write(40);
  }
  
  else  {
    servo0.write(160);
    servo1.write(160);
  }
}

void lightning (short flickerRate, short blackout) {
  if (i > 6) i = 6;
  
  // if target hit, reset routine
  if ((LDR0 > laserThresh)||(LDR1 > laserThresh)) {
    i = 0;
    lightning_strip.setBrightness(highBright);
    lightState = true;
    myDFPlayer.playMp3Folder(1);
  }

  // flicker on/off 5 times at flickerRate
  if ((millis() - flickerTime > flickerRate)&& (i < 5)) 
  {
    lightState = !lightState;
    if (lightState) setLightning(255,255,255);
    else setLightning(0,0,0);
    i++;
    flickerTime = millis();
  }

  // lights stay off for blackout time
  else if ((millis() - flickerTime > blackout)&& (i == 5)) 
  {
    lightning_strip.setBrightness(lowBright);
    for (short j = 0 ; j < 255 ; ) {
      if (fadeInTime - millis() > 25) {
        setLightning(0, j, 0);
        j++;
      }
      fadeInTime = millis();
    }
    
    lightState = !lightState;
    flickerTime = millis();
    i++;
    
  }
}

void trigger(short trig_time, short reload) {
  adjust = digitalRead(buttpin);

  if (adjust != lastButtonState) {
    lastDebounceTime = millis();
  }
  
  if ((millis() - lastDebounceTime) > 50) {
    
    if (adjust != buttonState) {
      buttonState = adjust;
  
      if ((buttonState == LOW) && (millis() > 500)) {
        highTime = millis();
      }
    }
  }
  lastButtonState = adjust;

  if ((millis() - highTime <= trig_time)&&(millis() > 500)) {
    if (highTime-lasthighTime >= reload) {
      digitalWrite(laserpin, HIGH);
      lasthighTime = highTime;
    }
    digitalWrite(indipin, LOW);
  }
  else {
    digitalWrite(laserpin, LOW);
    digitalWrite(indipin, HIGH);
  }
}

// Set all LEDs to a given color and apply it (visible)
void setLightning (byte red, byte green, byte blue) {
  for(byte i = 0; i < NUM_LEDS; i++ ) {
    lightning_strip.setPixelColor(i, lightning_strip.Color(red, green, blue));
  }
  lightning_strip.show();
}

// Set all LEDs to a given color and apply it (visible)
void setMom (byte red, byte green, byte blue) {
  for(byte i = 0; i < 2; i++ ) {
    mom.setPixelColor(i, mom.Color(red, green, blue));
  }
  mom.show();
}

// Set all LEDs to a given color and apply it (visible)
void setMelody (byte red, byte green, byte blue) {
  for(byte i = 0; i < 2; i++ ) {
    melody.setPixelColor(i, melody.Color(red, green, blue));
  }
  melody.show();
}
final String id = Hashing.murmur3_32().hashString(url, StandardCharsets.UTF_8).toString();
public enum FamilyMemberTypes {

    CHILD("CHILD", "Child"),
    FTH("FTH", "Father"),
    MTH("MTH", "Mother"),
    MGRMTH("MGRMTH", "Maternal Grandmother"),
    PGRMTH("PGRMTH", "Paternal Grandmother"),
    MGRFTH("MGRFTH", "Maternal Grandfather"),
    PGRFTH("PGRFTH", "Paternal Grandfather");

    private final String key;
    private final String value;

    FamilyMemberTypes(String key, String value) {
        this.key = key;
        this.value = value;
    }

    public String getKey() {
        return key;
    }

    public String getValue() {
        return value;
    }

    //Lookup table
    private static final Map<String, String> lookup = new HashMap<>();

    //Populate the lookup table on loading time
    static {
        for (FamilyMemberTypes familyMemberTypes : FamilyMemberTypes.values()) {
            lookup.put(familyMemberTypes.getKey(), familyMemberTypes.getValue());
        }
    }

    //This method can be used for reverse lookup purpose
    public static String getValue(String key) {
        return lookup.get(key);
    }

}
/* ----------------------------------------
Note: any modifications to these styles will be global 
---------------------------------------- */
.tippy-box {}
.tippy-content {}
.tippy-arrow {}

/* ----------------------------------------
You can also apply tooltip css overrides on the INTERIOR of your tooltips. Note: results may sometimes be unpredictable 馃槨
---------------------------------------- */
.tippy-box .style1 {
  font-family: courier;
  color: #0066FF;
  padding: 15px;
  display: inline-block;
}
<!-- jQuery -->
<script src="//code.jquery.com/jquery-latest.js"></script>
<!-- Popper -->
<script src="https://unpkg.com/@popperjs/core@2"></script>
<!-- Tippy -->
<script src="https://unpkg.com/tippy.js@6"></script>

<script language="javascript">
// This code will execute as soon as the document is loaded 
$(document).ready(function() {
    // Allow or disallow html in tooltips (default = false)
    tippy.setDefaultProps({allowHTML: true}); 
    // Transform elements
    let tooltip_elements = $('a[href^="#tooltip_"]');
    tooltip_elements.each(function(i){
        let link = $(this).attr('href');
        let tip = link.replace('#tooltip_', '');
        $(this).attr('data-tippy-content', tip);
        if (link.startsWith('#tooltip_')) {
          $(this).removeAttr('href').css('cursor', 'pointer');
        }
    });
    // Finally, call `tippy`
    tippy('[data-tippy-content]');
});</script>
class Solution {
    
    // Greedy solution implementing PriorityQueue
        
    public int minDeletions(String s) {
        int maxChar = 25;
        HashMap<Character, Integer> freq = new HashMap(maxChar);
        PriorityQueue<Integer> pq = new PriorityQueue(maxChar, new Comparator<Integer>(){
            public int compare(Integer o1, Integer o2){
                return o2 - o1;
            }
        });
        
        // Characters to delete
        int delCount = 0; 
        
        // Add characters to Map
        for(int i = 0; i < s.length(); i++){
            char c = s.charAt(i);
            
            if(!freq.containsKey(c))
                freq.put(c, 1);
            else
                freq.put(c, freq.get(c) + 1);
        }
        
        //for(Map.Entry entry : freq.entrySet())
            //System.out.println(entry.getKey() + ":" + entry.getValue());
        
        // Add character frequencies to PriorityQueue
        for(Map.Entry entry : freq.entrySet())
            pq.add((Integer) entry.getValue());
        
        
        // Traverse PriorityQueue
        while(!pq.isEmpty()){
            
            //printQ(pq);
            
            // store topmost entry
            int top = pq.peek();
            // remove topmost entry
            pq.remove();
            
            if(pq.isEmpty())
                break;
            
            if(top == pq.peek()){
                if(top > 1)
                    // insert decremented top entry
                    pq.add(top - 1);
                // increment character deletion count
                delCount++;
            }
        }
         
        return delCount;
    }
    
    public void printQ(PriorityQueue<Integer> pq){
        for(Integer i : pq)
            System.out.print(i +",");
        System.out.println();
    }
}
package com.mycompany.testoop;
import java.util.ArrayList;
import java.util.Scanner;
 
 
public class Main {
    static Scanner in = new Scanner(System.in);
    public static void main(String args[]){
        Employees [] ourEmployees = new Employees[] {new Employees(), new Employees(), new Employees(), new Employees()};
        for(int i=0; i<4; i++){
            ourEmployees[i].setId(in.nextInt());
            ourEmployees[i].setName(in.next());
            ourEmployees[i].setSalary(in.nextFloat());
        }
        
        for (int i=0; i<4; i++){
            System.out.println("Employee #" + (i+1) + " ==> " + "ID = " + ourEmployees[i].getId() + ", Name = " + ourEmployees[i].getName() + ", Salary = " + ourEmployees[i].getSalary());
        }
             
          
    }
    
}
 
 
 
package com.mycompany.testoop;
 
public class Employees {
    private int id;
    private String name;
    private float salary;
    
    // ****************Constructors*******************
    public Employees() {
    }
    public Employees(int id, String name, float salary) {
        this.id = id;
        this.name = name;
        this.salary = salary;
    }
    // ****************Setters & Getters*******************
    public int getId() {
        return id;
    }
 
    public void setId(int id) {
        this.id = id;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public float getSalary() {
        return salary;
    }
 
    public void setSalary(float salary) {
        this.salary = salary;
    }
    // ****************Our Methods*******************
 
    @Override
    public String toString() {
        return  "ID = " + id + ", Name = " + name + ", Salary = " + salary;
    }  
    
}
package com.mycompany.testoop;
import java.util.ArrayList;
import java.util.Scanner;
 
 
public class Main {
    static Scanner in = new Scanner(System.in);
    public static void main(String args[]){
          ArrayList <Employees> ourEmployees = new ArrayList();
          for (int i=0; i<4; i++){
              ourEmployees.add(new Employees(in.nextInt(), in.next(), in.nextFloat()));
          }
          for (int i=0; i<ourEmployees.size(); i++){ //10 20 30 
            System.out.println("Employee #" + (i+1) + " ==> " + ourEmployees.get(i) + " ");
        }     
          
    }
    
}
 
 
 
package com.mycompany.testoop;
 
public class Employees {
    private int id;
    private String name;
    private float salary;
    
    // ****************Constructors*******************
    public Employees() {
    }
    public Employees(int id, String name, float salary) {
        this.id = id;
        this.name = name;
        this.salary = salary;
    }
    // ****************Setters & Getters*******************
    public int getId() {
        return id;
    }
 
    public void setId(int id) {
        this.id = id;
    }
 
    public String getName() {
        return name;
    }
 
    public void setName(String name) {
        this.name = name;
    }
 
    public float getSalary() {
        return salary;
    }
 
    public void setSalary(float salary) {
        this.salary = salary;
    }
    // ****************Our Methods*******************
 
    @Override
    public String toString() {
        return  "ID = " + id + ", Name = " + name + ", Salary = " + salary;
    }  
    
}
package com.mycompany.testoop;
import java.util.ArrayList;
import java.util.Scanner;


public class Main {
    //*********************Main Needs***********************
    static public Scanner in = new Scanner(System.in);
    static ArrayList<Employee> ourEmployees = new ArrayList<>();
    //*********************Our Functions***********************
    static void displayMenu(){
        System.out.println("Please Choose From This Menu:\n   1- Add New Employee\n   2- Edit Current Employee\n   3- Remove Current Employee\n   4- Display All Employee\n");
    }
    static void addEmployee(){
        Employee emp = new Employee();
        System.out.println("ID: ");
        emp.setId(in.nextInt());
        System.out.println("First Name: ");
        emp.setFirstName(in.next());
        System.out.println("Last Name: ");
        emp.setLastName(in.next());
        System.out.println("Salary: ");
        emp.setSalary(in.nextFloat());
        System.out.println("Phone Number: ");
        emp.setPhoneNumber(in.next());
        ourEmployees.add(emp);
        //ourEmployees.add(new Employee(in.nextInt(), in.next(), in.next(), in.nextFloat(), in.next()));
    }
    static void editEmployee(int id){
        int lenght = ourEmployees.size();
        for(int i=0; i<lenght; i++){
            if(ourEmployees.get(i).getId() == id){
                System.out.println("ID: ");
                ourEmployees.get(i).setId(in.nextInt());
                System.out.println("First Name: ");
                ourEmployees.get(i).setFirstName(in.next());
                System.out.println("Last Name: ");
                ourEmployees.get(i).setLastName(in.next());
                System.out.println("Salary: ");
                ourEmployees.get(i).setSalary(in.nextFloat());
                System.out.println("Phone Number: ");
                ourEmployees.get(i).setPhoneNumber(in.next());
                break;
            }                
        }
    }
    static void removeEmployee(int id){
        int lenght = ourEmployees.size();
        for(int i=0; i<lenght; i++){
            if(ourEmployees.get(i).getId() == id){
                ourEmployees.remove(i);
                break;
            }                
        }
    }
    static void printAllEmployees(){
        for (int i=0; i<ourEmployees.size(); i++){
            System.out.println("Employee #" + (i+1) + " ==> " + ourEmployees.get(i) + " ");
        }
    }
    static void manageEmployees(){
        while(true){
            displayMenu();
            short choice;
            choice = in.nextShort();
            switch (choice){
                case 1:
                    addEmployee();
                    System.out.println("Done: New Employee Added");
                    System.out.println("================================");
                    break;
                case 2:
                    System.out.println("Enter Employee ID To Edit:");
                    int emppId = in.nextInt();
                    editEmployee(emppId);
                    System.out.println("Done: Current Employee Updated");
                    System.out.println("================================");
                    break;
                case 3:
                    System.out.println("Enter Employee ID To Remove:");
                    int empId = in.nextInt();
                    removeEmployee(empId);
                    System.out.println("Done: Current Employee Removed");
                    System.out.println("================================");
                    break;
                case 4:                   
                    printAllEmployees();
                    System.out.println("================================");
                    break;
                default:
                    System.out.println("!!!! Error: Invalid Number, please choose from the menu");
                    System.out.println("================================");
                    manageEmployees();
                    break;
            }
        }
    }
    
    //*********************Main Functions***********************
    public static void main(String args[]){
          manageEmployees();
    }
    
    
}





package com.mycompany.testoop;

public class Employee {
    //*********************Data Members*********************
    int id;
    String firstName;
    String lastName;
    float salary;
    String phoneNumber;
    
    //*********************Constructors*********************
    public Employee() {
    }
    public Employee(int id, String firstName, String lastName, float salary, String phoneNumber) {
        this.id = id;
        this.firstName = firstName;
        this.lastName = lastName;
        this.salary = salary;
        this.phoneNumber = phoneNumber;
    }
    
    //*********************Setters & Getters*********************
    public int getId() {
        return id;
    }

    public void setId(int id) {
        this.id = id;
    }

    public String getFirstName() {
        return firstName;
    }

    public void setFirstName(String firstName) {
        this.firstName = firstName;
    }

    public String getLastName() {
        return lastName;
    }

    public void setLastName(String lastName) {
        this.lastName = lastName;
    }

    public float getSalary() {
        return salary;
    }

    public void setSalary(float salary) {
        this.salary = salary;
    }

    public String getPhoneNumber() {
        return phoneNumber;
    }

    public void setPhoneNumber(String phoneNumber) {
        this.phoneNumber = phoneNumber;
    }
    //*********************Our Methods*********************
    @Override
    public String toString() {
        return "ID = " + id + ", Full Name = \"" + firstName + " " + lastName + "\" , Salary = " + salary + ", Phone Number = " + phoneNumber;
    }
    
    
}
for (Task t : taskList) {
  			//make new instances, to not override item
            TaskDTO taskDTO = new TaskDTO();
            TaskDTO tt = new TaskDTO();
            tt = convertSourceToTaskDTO(t, taskDTO);
            taskActivityResponse.getTaskDtoList().add(taskDTO);
        }
@EntendWith(SpringExtenstion.class)
//to focus on mvc components only
@WebMvcTest(ClassNameYoureGoingToTest.class)
class HelloControllerIntegrationTest{
  
  @Autowired 
  private MockMvc mvc;

  @Test
  void hello() throws Exception{
    RequestBuilder request = MockMvcRequestBuilders.get("/find/by/id");
    MvcResults result = mvc.perform(request).andReturn();
    //first param is expected value, second- actual value
    assertEquals("Hello, World", results.getResponse().getContentAsString());
  }

  @Test
  public void testHelloWithName throws Exception{
      mvc.perform(get("/find/by/id?id=123")).andExpect(content().string("Hello, Dan"));
  }

}

private TilePane selectedTilePane;
private TilePane currentTilePane;
private ImageView selectedImageView;

void onMouseClicked(MouseEvent event) {
  this.resetTileBackgroundColor();
  this.selectedImageView = (ImageView) event.getSource();
  this.selectedTilePane = (TilePane) this.selectedImageView.getParent();
  this.selectedTilePane.setStyle("-fx-background-color:gray");

}

void onMouseEntered(MouseEvent event) {
  this.currentTilePane = (TilePane) event.getSource();
  if (!this.currentTilePane.equals(this.selectedTilePane)) {
    this.currentTilePane.setStyle("-fx-background-color:lightgray");
  }
}

void onMouseExited(MouseEvent event) {
  this.currentTilePane = (TilePane) event.getSource();
  if (!this.currentTilePane.equals(this.selectedTilePane)) {
    this.currentTilePane.setStyle("-fx-background-color:whitesmoke");
  }
}

private void resetTileBackgroundColor() {
  tilePane<XXXXX>.setStyle("-fx-background-color:whitesmoke");
}
Fire Event:

Intent intent = new Intent(YOUR_EVENT_NAME);
LocalBroadcastManager.getInstance(context).sendBroadcast(intent);

Receive Event:

LocalBroadcastManager.getInstance(context).registerReceiver(receiverName,
new IntentFilter(YOUR_EVENT_NAME));

private BroadcastReceiver receiverName = new BroadcastReceiver() {
        @Override
        public void onReceive(Context context, Intent intent) {
          
        }
};
for (AsegurableDtoResponse objAsegurable : listAsegurables) {
					for (GrupoDto objGrupo : objAsegurable.getGrupos()) {
						int intIdPoliza = objGrupo.getNroPoliza();

						GrupoDto objGrupoPorPoliza = (GrupoDto) objAsegurable.getGrupos().stream().filter(grupo -> grupo.getNroPoliza() == intIdPoliza);
						AsegurableDtoResponse objAsegurablePorPoliza = (AsegurableDtoResponse) objAsegurable.getGrupos().stream().filter(grupo -> grupo == objGrupoPorPoliza);
						listAsegurablesFiltradosPorPoliza.add(objAsegurablePorPoliza);
					}
				}
import java.io.IOException;
import java.nio.file.Files;
import java.nio.file.Path;

public class WriteToFile
{
	public static void main(String[] args) throws IOException
	{
		Path fileName = Path.of("demo.txt");
	    String content  = "hello world !!";
	    Files.writeString(fileName, content);

	    String actual = Files.readString(fileName);
	    System.out.println(actual);
	}
}
String jsonString = new com.google.gson.Gson().toJson(myObject);
Gson gson = new Gson();
List<Product> products = gson.fromJson(jsonString, new TypeToken<List<Product>>(){}.getType());
$ git reset --hard HEAD~1

HEAD is now at 90f8bb1 Second commit
Class P6
{
 public static void test(int a , long b) 
  {
    System.out.println('Test with int and long')
  }
 public static void test(long a , int b)
  {
    System.out.println('Test with long and int')
  }
 public static void main(String []args)
  {
    test(10 , 20);
  }
}
  public static EasyRandomParameters getEasyRandomParameters(int collectionSize) {
    return new EasyRandomParameters()
        .randomize(BigDecimal.class, BIG_DECIMAL_RANDOMIZER)
        .collectionSizeRange(collectionSize, collectionSize);
  }

  public static final Randomizer<BigDecimal> BIG_DECIMAL_RANDOMIZER =
      () ->
          BigDecimal.valueOf(ThreadLocalRandom.current().nextDouble(0, 100))
              .setScale(8, RoundingMode.DOWN);
  public static final Randomizer<BigDecimal> BIG_DECIMAL_RANDOMIZER =
      () ->
          BigDecimal.valueOf(ThreadLocalRandom.current().nextDouble(0, 100))
              .setScale(8, RoundingMode.DOWN);
public void resetCells() {
  for (int row = 0; row < grid.getRows(); row++) {
    for (int column = 0; column < grid.getRows(); column++) {
      resetCell(new Coordinates(row, column));
    }
  }
}
public void initialiseCells() {
  for (int row = 0; row < grid.getRows(); row++) {
    for (int column = 0; column < grid.getColumns(); column++) {
      initialiseCell(new Coordinates(row, column));
    }
  }
}

private void initialiseCell(Coordinates coordinates) {
  Cell cell = new Cell();

  addAlivePropertyListener(cell);
  addClickEventHandler(cell);

  grid.add(cell, coordinates);
}

private void addAlivePropertyListener(Cell cell) {
  cell.aliveProperty()
    .addListener(newValue -> setAliveStyle(cell, newValue));
}

private void setAliveStyle(Cell cell, boolean isAlive) {
  List<String> styleClass = cell.getStyleClass();
  if (isAlive) {
    styleClass.add(ALIVE_STYLE_CLASS);
  } else {
    styleClass.remove(ALIVE_STYLE_CLASS);
  }
}

private void addClickEventHandler(Cell cell) {
  cell.addEventHandler(MouseEvent.MOUSE_CLICKED,
    event -> cell.toggleAlive());
}

public void resetCells() {
  for (int row = 0; row < grid.getRows(); row++) {
    for (int column = 0; column < grid.getRows(); column++) {
      resetCell(new Coordinates(row, column));
    }
  }
}

private void resetCell(Coordinates coordinates) {
  Cell cell = grid.get(coordinates);

  cell.aliveProperty().setValue(false);
}
+	Suma	a + b
-	Resta	a - b
*	Multiplicaci贸n	a * b
/	Divisi贸n	a / b
%	M贸dulo	a % b
Operadores de asignaci贸n
=	Asignaci贸n	a = b
+=	Suma y asignaci贸n	a += b (a=a + b)
-=	Resta y asignaci贸n	a -= b (a=a - b)
*=	Multiplicaci贸n y asignaci贸n	a *= b (a=a * b)
/=	Divisi贸n y asignaci贸n	a / b (a=a / b)
%=	M贸dulo y asignaci贸n	a % b (a=a % b)
Operadores relacionales
==	Igualdad	a == b
!=	Distinto	a != b
<	Menor que	a < b
>	Mayor que	a > b
<=	Menor o igual que	a <= b
>=	Mayor o igual que	a >= b
Operadores especiales
++	Incremento	a++ (postincremento)
++a 聽 (preincremento)
--	Decremento	a-- (postdecremento)
--a 聽(predecremento)
(tipo)expr	Cast	a = (int) b
+	Concatenaci贸n de cadenas	a = "cad1" + "cad2"
.	Acceso a variables y m茅todos	a = obj.var1
( )	Agrupaci贸n de expresiones	a = (a + b) * c


La tabla siguiente muestra la precedencia asignada a los operadores, 茅stos son listados en orden de precedencia.

Los operadores en la misma fila tienen igual precedencia

Operador	Notas
. 聽 [] 聽 ()	Los corchetes se utilizan para los arreglos
++ 聽 -- 聽 ! 聽 ~	! es el NOT l贸gico y ~ es el complemento de bits
new (tipo)expr	new se utiliza para crear instancias de clases
* 聽 / 聽 %	Multiplicativos
+ -	Aditivos
<< 聽 >> 聽 >>>	Corrimiento de bits
< 聽 > 聽 <= 聽 >=	Relacionales
== 聽 !=	Igualdad
&	AND (entre bits)
^	OR exclusivo (entre bits)
|	OR inclusivo (entre bits)
&&	AND l贸gico
||	OR l贸gico
? :	Condicional
= 聽 += 聽 -= 聽 *= 聽 /= 聽 %= 聽 &= 聽 ^= 聽 |= 聽 <<= 聽 >>= 聽 >>>=	Asignaci贸n
Un ejemplo completo, que diera a la variable "par" el valor 1 si un n煤mero "n" es par, o el valor 0 en caso contrario, ser铆a:

// Condicional1.java
// Ejemplo de "operador condicional" (o ternario)
// Introducci贸n a Java, Nacho Cabanes
 
class Condicional1 {
 
    public static void main( String args[] ) {
 
        int n = 4;
        int par;

  // condicion ? resultado_si cierto : resultado_si_falso
        par = n % 2 == 0 ?  1 : 0;
 
        System.out.print( "\"par\" vale... " );
        System.out.println( par );
    }
}
condicion ? resultado_si cierto : resultado_si_falso
Es decir, se indica la condici贸n seguida por una interrogaci贸n, despu茅s el valor que hay que devolver si se cumple la condici贸n, a continuaci贸n un s铆mbolo de "dos puntos" y finalmente el resultado que hay que devolver si no se cumple la condici贸n.

Es frecuente emplearlo en asignaciones (aunque algunos autores desaconsejan su uso porque puede resultar menos legible que un "if"), como en este ejemplo:

x = (a == 10) ? b*2 : a ;
En este caso, si "a" vale 10, la variable "x" tomar谩 el valor de b*2, y en caso contrario tomar谩 el valor de a. Esto tambi茅n se podr铆a haber escrito de la siguiente forma, m谩s larga pero m谩s legible:

if (a == 10)
  x = b*2;
else
  x = a;
class If6 {
 
    public static void main( String args[] ) {
 
        int a = 7;
        int b = 1;
 
        if ( ((a == 3) || ( b > 5))
            || ((a == 7)  && ! (b < 4)) )  {
            System.out.println( "Se cumple la condici贸n" );
        }
        else {
            System.out.println( "No se cumple la condici贸n" );
        }
    }
}
class If4 {
 
    public static void main( String args[] ) {
 
        int x = 10;
 
        if (x != 5) {
            System.out.println( "x no vale 5" );
        }
        else {
            System.out.println( "x vale 5" );
        }
    }
}
// Java program to demonstrate use of a
// string to control a switch statement.
public class Test聽
{
聽聽聽聽public static void main(String[] args)
聽聽聽聽{
聽聽聽聽聽聽聽聽String str = "two";
聽聽聽聽聽聽聽聽switch(str)
聽聽聽聽聽聽聽聽{
聽聽聽聽聽聽聽聽聽聽聽聽case "one":
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽System.out.println("one");
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽break;
聽聽聽聽聽聽聽聽聽聽聽聽case "two":
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽System.out.println("two");
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽break;
聽聽聽聽聽聽聽聽聽聽聽聽case "three":
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽System.out.println("three");
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽break;
聽聽聽聽聽聽聽聽聽聽聽聽default:
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽System.out.println("no match");
聽聽聽聽聽聽聽聽}
聽聽聽聽}
}
El m茅todo equals(), se utiliza para comparar dos objetos. Ojo no confundir con el operador ==, que ya sabemos que sirve para comparar tambien, equals compara si dos objetos apuntan al mismo objeto.

Equals() se usa para saber si dos objetos son del mismo tipo y tienen los mismos datos. Nos dara el valor true si son iguales y false si no.
System.out.print("Enter聽full聽name:聽");聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽//Create聽scanner聽object聽and聽read聽the聽value聽from聽the聽console聽聽
聽聽聽聽聽聽聽聽Scanner聽scan聽=聽new聽Scanner(System.in);聽聽
聽聽聽聽聽聽聽聽//Read聽the聽first聽token聽聽
聽聽聽聽聽聽聽聽String聽firstName聽=聽scan.next();聽聽
聽聽聽聽聽聽聽聽//Read聽the聽second聽token聽聽
聽聽聽聽聽聽聽聽String聽lastName聽=聽scan.next();聽聽
聽聽聽聽聽聽聽聽//Print聽the聽token聽values聽read聽by聽Scanner聽object聽聽
聽聽聽聽聽聽聽聽System.out.println("First聽Name聽is:聽"+firstName);聽聽
聽聽聽聽聽聽聽聽System.out.println("Last聽Name聽is:聽"+lastName);聽聽聽聽
聽聽聽聽聽聽聽聽scan.close();聽聽
Script:

class HelloWorld
{
        public static void main(String args[])
    {
        System.out.println("Hello World!");
    }
}


Saved as HelloWorld.java

Executing it: 

module load java 
javac HelloWorld.java
java HelloWorld 
public void addAtEnd(int item) {
		Node nn = new Node(item);
		
		  //Attach new node to the previous node
		if(this.size >= 1)
			  this.tail.next = nn;
		  
		  //Shift tail at the end node
		  else head = nn;
		  
		  tail = nn;
		  size++;
		}
public void displayList() {
		Node temp = new Node();
		temp = this.head;

		while(temp != null) {
			System.out.print(temp.data+", ");
			temp = temp.next;
		}
	}
int getAt(int idx) throws Exception {
		  
		  if(size == 0){
		    throw new Exception("LinkedList is empty");
		  }
		  if(idx < 0 || idx >= this.size){
		    throw new Exception("Invalid index");
		  }
		  
		  Node temp = this.head;
		  for(int i=1;  i <= idx; i++){
		    temp = temp.next;
		  }
		  
		  return temp.data;
		  
		}
private Node getNodeAt(int idx) throws Exception {
  if(this.size == 0){
    throw new Exception("LinkedList is empty");
  }
  if(idx < 0 || idx >= this.size){
    throw new Exception("Invalid Index");
  }
  
  Node temp = this.head;
  
  for(int i = 1; i <= idx; i++){
    temp = temp.next;
  }
  
  return temp;
}
public void addAtBegin(int item){
  Node nn = new Node();
  nn.data = item;
  
  //attach new node to the previous node 
  if(this.size >= 1)
    nn.next = head;
  else
    this.tail = nn;
  
  //shift head of previous node to the ned node
  this.head = nn;
  this.size++;
}
void printListInRecursion(Node head){
  Node curr = head;
  
  if(curr == null)
    return;
  
  System.out.print(curr.data+" ");
  printListInRecursion(curr.next);
}
class Vehicle {
  protected String brand = "Ford";        // Vehicle attribute
  public void honk() {                    // Vehicle method
    System.out.println("Tuut, tuut!");
  }
}

class Car extends Vehicle {
  private String modelName = "Mustang";    // Car attribute
  public static void main(String[] args) {

    // Create a myCar object
    Car myCar = new Car();

    // Call the honk() method (from the Vehicle class) on the myCar object
    myCar.honk();

    // Display the value of the brand attribute (from the Vehicle class) and the value of the modelName from the Car class
    System.out.println(myCar.brand + " " + myCar.modelName);
  }
}

 
mvn -U io.quarkus:quarkus-maven-plugin:create \
        -DprojectGroupId=org.agoncal.quarkus.microservices \
        -DprojectArtifactId=rest-book \
        -DclassName="org.agoncal.quarkus.microservices.book.BookResource" \
        -Dpath="/api/books" \
        -Dextensions="resteasy-jsonb, smallrye-openapi"
  Scanner scn = new Scanner(System.in);
    int n = scn.nextInt();
    int m = scn.nextInt();
    
    int [][]arr = new int[n][m];
    
    for(int i=0;i<arr.length;i++){
        for(int j=0;j<arr[0].length;j++){
            one [i][j] = scn.nextInt();
        }
    }
import java.util.function.*;
public class SupplierTest {


  public static void main(String args[]) {
    Supplier<Person> supplier = () -> new Person("Mohan", 23);
    Predicate<Person> predicate = (p) -> p.age > 18;
    boolean eligible = predicate.test(supplier.get());
    Function<Person,String> getName = p -> p.name; 
    System.out.println(getName.apply(supplier.get())+" is eligible for voting: " + eligible);
  }
}

class Person {
  String name;
  int age;

  Person(String name, int age) {
    this.name = name;
    this.age = age;
  }
}
import java.util.*;
import java.lang.Math;

class prime {
  public static boolean is_prime(int n) {
    if (n < 2) {
      return false;
    }
    
    if (n == 2) {
      return true;
    }
    
    if (n % 2 == 0) {
      return false;
    }
    
    for (int i = 3; i < Math.sqrt(n) + 1; i += 2) {
      if (n % i == 0) {
        return false;
      }
    }
    
    return true;
  }
  
  public static void main(String args[]) {
    int start, end;
    Scanner sc = new Scanner(System.in);
    
    System.out.println("Enter start value of range:");
    start = sc.nextInt();
    
    System.out.println("Enter end value of range:");
    end = sc.nextInt();
    
    System.out.println("List of primes:");
    for (int i = start; i <= end; i++) {
      if (is_prime(i)) {
        System.out.println(i);
      }
    }
  }
}
    
    
  	
/**
Precondition: n>=1 
Returns the sum of the squares of the numbers 1 through n. 
*/
public static int squares(int n) {				
   if(n<1) {
      return 1;		
   }		
   else {
      sum+=Math.pow(n, 2);
      squares(n-1);
      return sum;
   }		
}
/**
Precondition: n>=1 
Returns the sum of the squares of the numbers 1 through n. 
*/
public static int squares(int n) {				
   if(n<1) {
      return 1;		
   }		
   else {
      sum+=Math.pow(n, 2);
      squares(n-1);
      return sum;
   }		
}
Set<JobKey> jobKeys = scheduler.getJobKeys(GroupMatcher.anyJobGroup());

Iterator<JobKey> it = jobKeys.iterator();
while(it.hasNext()){
  System.out.println(it.next());

  JobKey key = it.next();
  scheduler.deleteJob(key);
}
public class ${Class Name} {

  // Singleton instance variable
  private static ${Class Name} instance;

  /**
   * Constructor
   */
  private ${Class Name}() {}

  /**
   * Getter for retrieving instance
   */
  public static synchronized ${Class Name} getInstance() {
    if (instance == null) {
      instance = new ${Class Name}();
    }
    return instance;
  }
}
	
Disable the gatekeeper via sudo spctl --master-disable.
Install application.
Re-enable the gatekeeper via sudo spctl --master-enable.
public String performPost(File file, String url) {
    HttpPost httppost = new HttpPost(url);
    InputStream content = null;

    try {

        List<NameValuePair> nameValuePairs = new ArrayList<NameValuePair>(2);
        nameValuePairs.add(new BasicNameValuePair("articleattachement[content]", encode(file)));

        httppost.setEntity(new UrlEncodedFormEntity(nameValuePairs));

        Log.d("DEBUG", "UPLOAD: executing request: " + httppost.getRequestLine());
        Log.d("DEBUG", "UPLOAD: request: " + httppost.getEntity().getContentType().toString());

        content = execute(httppost).getEntity().getContent();

        ByteArrayOutputStream bout = new ByteArrayOutputStream();
        byte[] buf = new byte[1024];
        int len;
        while ((len = content.read(buf)) > 0) {
            bout.write(buf, 0, len);
        }
        content.close();
        return bout.toString();
    } catch (FileNotFoundException e) {
        e.printStackTrace();
    } catch (ClientProtocolException e) {
        e.printStackTrace();
    } catch (IOException e) {
        e.printStackTrace();
    }
    return null;
}

public String encode(File file) throws IOException {
    byte[] data=null;
    try {

        data = getFileBytes(new FileInputStream(file.getAbsolutePath()));
    } catch (Exception e) {
        e.printStackTrace();
    }

    return Base64.encodeToString(data,Base64.URL_SAFE);
}

public byte[] getFileBytes(InputStream ios) throws IOException {
    ByteArrayOutputStream ous = null;
    //InputStream ios = null;
    try {
        byte[] buffer = new byte[4096];
        ous = new ByteArrayOutputStream();
        //ios = new FileInputStream(file);
        int read = 0;
        while ((read = ios.read(buffer)) != -1)
            ous.write(buffer, 0, read);
    } finally {
        try {
            if (ous != null)
                ous.close();
        } catch (IOException e) {
            // swallow, since not that important
        }
        try {
            if (ios != null)
                ios.close();
        } catch (IOException e) {
            // swallow, since not that important
        }
    }
    return ous.toByteArray();
}
import聽java.util.Scanner;
public聽class聽sum聽{
聽聽聽聽
聽聽public聽static聽int聽arraysum(int
[][]arr,int聽n)聽聽
聽聽聽聽{
聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽
聽聽int聽left聽=0;
聽聽int聽right聽=0;
聽聽int聽abs=0;
for(int聽I=0;I<arr.length;I++)聽
聽聽聽聽{
聽聽聽聽聽聽聽聽
for(int聽J=0;J<arr.length;J++)聽聽聽
聽{
聽聽聽聽
聽聽if聽(I==J)
left+=arr[I][J];
if聽(I+J==n-1) 
right+=arr[I][J];
}
}

abs=left-right;



聽聽聽聽聽聽return聽聽abs;
聽聽聽聽}
聽聽聽聽聽聽聽
聽聽聽聽
聽public聽static聽void聽main(String聽
[]args)
聽
聽聽聽聽{
聽Scanner聽input聽=new聽Scanner
(System.in);
聽聽聽聽聽聽聽聽int聽n;
聽聽聽聽聽聽聽聽n=input.nextInt();
聽聽聽聽聽聽聽聽int[][]ARR=new聽int[n][n]
;
聽聽聽聽聽聽聽聽for聽(int聽i=0;i<n;i++)聽
聽聽聽聽聽聽聽聽{
聽聽聽聽聽聽聽聽聽聽聽for聽(int聽j=0;j<n;j++)
聽聽聽聽聽聽聽聽聽聽聽{
聽聽ARR[i][j]=input.nextInt();
聽聽聽聽聽聽聽聽聽聽聽聽聽聽聽
聽聽聽聽聽聽聽聽聽聽聽}
聽聽聽聽聽聽聽              }   System.out.print(Math.abs(arraysum(ARR,n)));         }  聽聽聽聽
聽聽聽聽聽聽聽聽
String Field_Name = Object_Name__c.Field_Name__c.getDescribe().isAccessible();

String Field_Name = Object_Name__c.Field_Name__c.getDescribe().getRelationshipName();

List<Schema.PicklistEntry> pickList_values = Object_Name__c.Field_Name__c.getDescribe().getPicklistValues();

String Field_Name = Object_Name__c.Field_Name__c.getDescribe().getDefaultValue();

String Field_Name = Object_Name__c.Field_Name__c.getDescribe().getLabel();

Random r = new Random();
char c = (char)(r.nextInt(26) + 'a');
JSONArray userJSONArray = json.getJSONArray("data");
for (int i = 0; i < userJSONArray.size(); i++) {
    JSONObject jsonObject = userJSONArray.getJSONObject(i);
    User user = JSON.parseObject(jsonObject.toJSONString(), User.class);
}
public <T> List<Class<? extends T>> findAllMatchingTypes(Class<T> toFind) {
    foundClasses = new ArrayList<Class<?>>();
    List<Class<? extends T>> returnedClasses = new ArrayList<Class<? extends T>>();
    this.toFind = toFind;
    walkClassPath();
    for (Class<?> clazz : foundClasses) {
        returnedClasses.add((Class<? extends T>) clazz);
    }
    return returnedClasses;
}
// Add first contact and related details
Contact contact1 = new Contact(
   Firstname='Quentin',
   Lastname='Foam',
   Phone='(415)555-1212',
   Department= 'Specialty Crisis Management',
   Title='Control Engineer - Specialty - Solar Arrays',
   Email='qfoam@trailhead.com');
insert contact1;
// Add second contact and related details
Contact contact2 = new Contact(
   Firstname='Vega',
   Lastname='North',
   Phone='(416)556-1312',
   Department= 'Specialty Crisis Management',
   Title='Control Engineer - Specialty - Propulsion',
   Email='vnorth@trailhead.com');
insert contact2;
// Add third contact and related details
Contact contact3 = new Contact(
   Firstname='Palma',
   Lastname='Sunrise',
   Phone='(554)623-1212',
   Department= 'Specialty Crisis Management',
   Title='Control Engineer - Specialty - Radiators',
   Email='psunrise@trailhead.com');
insert contact3;
FIND {Crisis} IN ALL FIELDS RETURNING Contact(FirstName, LastName, Phone, Email, Title)
<?xml version="1.0" encoding="UTF-8"?>
<LightningComponentBundle xmlns="http://soap.sforce.com/2006/04/metadata" fqn="helloWorld">
  <apiVersion>45.0</apiVersion>
  <isExposed>true</isExposed>
  <targets>
    <target>lightning__AppPage</target>
    <target>lightning__RecordPage</target>
    <target>lightning__HomePage</target>
  </targets>
</LightningComponentBundle>
import { LightningElement } from 'lwc';
export default class HelloWorld extends LightningElement {
  greeting = 'World';
  changeHandler(event) {
    this.greeting = event.target.value;
  }
}
<template>
  <lightning-card title="HelloWorld" icon-name="custom:custom14">
    <div class="slds-m-around_medium">
      <p>Hello, {greeting}!</p>
      <lightning-input label="Name" value={greeting} onchange={changeHandler}></lightning-input>
    </div>
  </lightning-card>
</template>
#include<iostream>
#include<fstream>
using namespace std;

class Bank_Customer
{
protected:
	char name[40];
	int age;
	int balance;
	char gender;
	char phone[15];
	char address[50];
public:
	void getdata(void) {
		cout << "Enter name:"; cin >> name;
		cout << "Enter age:"; cin >> age;
		cout << "Enter balance:"; cin >> balance;
		cout << "Enter gender(m/f):"; cin >> gender;
		cout << "Enter phone number:"; cin >> phone;
		cout << "Enter Address:"; cin >> address;
	}
	void showdata(void) {
		cout << "\nName:" << name;
		cout << "\nAge:" << age;
		cout << "\nBalance:" << balance;
		cout << "\nGender:" << gender;
		cout << "\nPhone number:" << phone;
		cout << "\nAddress:" << address;
		cout << endl;
	}
	void CreateFile(void){
		fstream file;
		file.open("Customer.txt", ios::app | ios::out | ios::binary);
		if (!file) {
			cerr << "error:input file cannot be opened.\n";
			exit(1);
		}
		else if(file)
		{
			cout << "file already exists and ready for input";
		}
		else
		{
			cout << "File Created Successfuly" << endl << endl;
		}
		file.close();
		
	}
	void AddRecord() {
		ofstream outfile;
		outfile.open("Customer.txt", ios::app | ios::out | ios::binary);
		Bank_Customer c;
		char choice;
		do {
			cout << "\nEnter person's data:" << endl;
			c.getdata();
			outfile.write((char*)&c, sizeof(c));
			cout << "do you want to add another record?(y/n):";
			cin >> choice;

		} while (choice=='y');
		outfile.close();
	}
	void DisplayAllRecords() {
		Bank_Customer cc;
		fstream file;
		file.open("Customer.txt", ios::in | ios::binary);
		if (!file)
		{
			cerr << "Error:input file cannot be openend\n";
			exit(1);
		}
		file.seekg(0);
		file.read((char*)&cc, sizeof(cc));
		while (!file.eof())
		{
			cout << "\nCustomer:";
			cc.showdata();
			file.read((char*)&cc, sizeof(cc));
		}
		cout << endl;
	}
};
int main(void)
{
	cout << "_____Welcome_to__Bank_System_____" << endl;
	cout << "Choose_from_list:" << endl;
	cout << "1-Create-file" << endl;
	cout << "2-Add-record(add customer)" << endl;
	cout << "3-Display all records(Display all customers)" << endl;
	cout << "4-Exit" << endl;
	int ans;
	cin >> ans;
	Bank_Customer cust;
	switch (ans)
	{
	case 1:
		cust.CreateFile();
		cust.AddRecord();
		break;
	case 2:
		cust.AddRecord();
		break;
	case 3:
		cust.DisplayAllRecords();
		break;
	case 4:
		exit(1);
	default:
		cout << "Error";
		exit(1);
		break;
	}
	system("pause");
}
#include <bits/stdc++.h>
using namespace std;

/* class definition for each record */
class Employee{
    
    int id;
    string name;
    
    public:

    Employee(int Id, string Name){
        id = Id;
        name = Name;
    }

    int getid(){
        return id;
    }

    void print(){
        cout<<"Id : "<<id<<"\n";
        cout<<"Name : "<<name<<"\n";
    }

};

/* class definition which stores multiple records of 'Employee' type */
class EmployeeFile
{
    
    vector<Employee> file;

	public:

    void add(int id, string name){
        file.push_back(Employee(id,name));
    }

    Employee search(int id){
        for(auto f : file){
            if(f.getid() == id)
                return f;
        }
        return {0,""};
    }

    void print(){
        for(auto f : file){
            f.print();
        }
    }

};

int main() {
	
    EmployeeFile emp;

    /* input number of records */
    int n;
    cin>>n;

    for(int i=0;i<n;i++){
        int id;
        string name;
        cin>>id>>name;
        /* add record */
        emp.add(id,name);
    }

    cout<<"List of employees\n";
    /* print records */
    emp.print();

    int key;
    cin>>key;

    /* search record with key */
    Employee e = emp.search(key);

    cout<<"Searched employee\n";
    e.print();
    
	return 0;
}
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
class employeefile {
private:
	char employee[20];
	char worktype[20];
	int age;
public:
	void getdata(void)
	{
		cout << "Enter employee name:"; cin >>employee;
		cout << "Enter work type:"; cin >> worktype;
		cout << "Enter age:"; cin >> age;
	}
	void showdata(void)
	{
		cout << "\n employee name:"<<employee<<endl;
		cout << "\n work type:" << worktype << endl;
		cout << "\n age:" << age << endl;
	}

};
int main()
{
	employeefile E;
	E.getdata();
	ofstream creatfile("employee.txt" /*ios::binary*/);
	creatfile.write((char*)&E, sizeof(E));
	creatfile.close();
	ifstream infine("employee.txt" /*ios::binary*/);
	infine.read((char*)&E, sizeof(E));
	E.showdata();
	infine.close();
	return 0;
};
#include<iostream>
#include<fstream>
using namespace std;
class employeefile {
private:
	char employee[20];
	char worktype[20];
	int age;
public:
	void getdata(void)
	{
		cout << "Enter employee name:"; cin >>employee;
		cout << "Enter work type:"; cin >> worktype;
		cout << "Enter age:"; cin >> age;
	}
	void showdata(void)
	{
		cout << "\n employee name:"<<employee<<endl;
		cout << "\n work type:" << worktype << endl;
		cout << "\n age:" << age << endl;
	}

};
int main()
{
	employeefile E;
	E.getdata();
	ofstream creatfile("employee.txt", ios::binary);
	creatfile.write((char*)&E, sizeof(E));
	creatfile.close();
	ifstream infine("employee.txt", ios::binary);
	infine.read((char*)&E, sizeof(E));
	E.showdata();
	infine.close();
}
//binary input and output with integer.
//we use two functions:write()andread().
//they transfer a buffer full of bytes to and from a disk file.
//the parameters to write() and read() are the buffer address.
//and its length.
#include<fstream>
#include<iostream>
using namespace std;
const int Max = 100;
int buff[Max];
int main()
{
	for (int i = 0; i < Max; i++)
	{
		buff[i] = i;
	}
	ofstream os("edata.txt", ios::binary);
	os.write((char*)buff, Max * sizeof(int));
	os.close();
	for (int i = 0; i < Max; i++)
	{
		buff[i] = 0;
	}
	ifstream is("edata.txt", ios::binary);
	is.read((char*)buff, Max * sizeof(int));
	for (int i = 0; i < Max; i++)
	{
		if (buff[i]!=i)
		{
			cerr << "\ndata is incorrect";
			return 0;
		}
		else
		{
			cout << "\ndata is correct";
		}
	}
}


#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
	/*ofstream outfile("grade.txt", ios::out);
	if (!outfile)
	{
		cerr << "error:output file cannot be opened\n";
		exit(1);
	}
	char id[9], name[16];
	int grade;
	cout << "\t1:";
	int n = 1;
	while (cin>>id>>name>>grade)
	{
		if (n==3)
		{
			break;

		}
		outfile << name << " " << id << " " << grade << endl;
		cout << "\t" << ++n << ":";
	}
	outfile.close();*/
	ifstream infile("grade.txt", ios::in);
	if (!infile)
	{
		cerr << "error:input file cannot be opened.\n";
		exit(1);
	}
	char id[9], name[16];
	int grade, sum = 0, count = 0;
	while (infile>>id>>name>>grade)
	{
		sum += grade;
		++count;
	}
	infile.close();
	cout << "the grade average is:" << float(sum) / count << endl;
}
ios::in allows input (read operations) from a stream.
ios::out allows output (write operations) to a stream.
| (bitwise OR operator) is used to combine the two ios flags,
meaning that passing ios::in | ios::out to the constructor
of std::fstream enables both input and output for the stream.
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
	ofstream outfile("grades.txt", ios::out);//ios::out Write operations.
	if (!outfile)
	{
		cerr << "error:output file cannot be opened\n";
		exit(1);
	}
	char id[9], name[16];
	int grade;
	cout << "\t:";
	int n = 1;
	while (cin>>id>>name>>grade)
	{
		outfile << name << " " << id << " " << grade << endl;
		cout << "\t" << ++n << ":";
	}
	outfile.close();

}
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
	ofstream outfile("grades.txt", ios::out);
	if (!outfile)
	{
		cerr << "error:output file cannot be opened\n";
		exit(1);
	}
	char id[9], name[16];
	int grade;
	cout << "\t:";
	int n = 1;
	while (cin>>id>>name>>grade)
	{
		outfile << name << " " << id << " " << grade << endl;
		cout << "\t" << ++n << ":";
	}
	outfile.close();

}
//Read from the file.
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
	//Create a text file.
	ofstream Mywritefile("fileAhmed.txt");
	//Write to the file.
	Mywritefile << "Ahmed abdelmoneim!\nmohamed";
	//Close the file.
	Mywritefile.close();
	//Create a text string,
	string myText;
	//read from the text
	ifstream Myreadfile("fileAhmed.txt");

	while (getline(Myreadfile, myText))
	{

		cout << myText;
	}
	
	Myreadfile.close();
};
//Read from the file.
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
	//Create a text file.
	ofstream Mywritefile("fileAhmed.txt");
	//Write to the file.
	Mywritefile << "Ahmed abdelmoneim!";
	//Close the file.
	Mywritefile.close();
	//Create a text string,
	string myText;
	//read from the text
	ifstream Myreadfile("fileAhmed.txt");
	while (getline(Myreadfile, myText))
	{
		cout << myText;
	}
	Myreadfile.close();
};
/*the fstream library allows us to work with files.
To use The fstream library,include both the standard:
<iostream>AND the <fstream> header file:
Example:
#include<iostream>
#include<fstream>
there are three classes included in the fstream Library.
Which are used to Create,Write or read file:
ofstream:Create and Writes to files.
ifstream:Reads from files.
fstream:A Combination of ofstream and ifstream:creates,reads,and writeto files.*/
/*******************************************************************************/
//Create and Write To File.
#include<iostream>
#include<fstream>
using namespace std;
int main()
{
	//Create and open a text file.
	ofstream Myahmedfile("ahmedfile.txt");
	//Write to the file.
	Myahmedfile << "Hello Ahmed Abdelmoneim";
	//Close the file.
	Myahmedfile.close();
}
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
	ofstream Myfiles("Myfiles.txt", ios::in | ios::out | ios::app);// add new words
	if (Myfiles.fail())
	{
		cout << "cant out open file\n";
		exit(1);
	}
	string str;
	
	
	while (cin >> str) 
	{
		if (str=="1"){break;}
		Myfiles << str<<"\n";
	}
	Myfiles.close();
}
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
	ofstream Myfiles("Myfiles.txt",ios::app);// add new words
	if (Myfiles.fail())
	{
		cout << "cant out open file\n";
		exit(1);
	}
	cout << "Let's use the output stream\n";
	Myfiles << "Hello world\n";
	Myfiles.close();

}
#include<iostream>
#include<fstream>
#include<string>
using namespace std;
int main()
{
	ofstream Myfiles("Myfiles.txt");
	if (Myfiles.fail())
	{
		cout << "cant out open file\n";
		exit(1);
	}
	cout << "Let's use the output stream\n";
	Myfiles << "Hello world\n";
	Myfiles.close();

}
#include<iostream>
#include<fstream>
#include<cassert>
using namespace std;
int main()
{
	ifstream inputStream("input.txt");
	if (inputStream.fail())
	{
		cout << "Sees file is not there...or can't open it\n";
		return 0;
	}
	int x;
	inputStream >> x;
	inputStream.close();
}
import java.util.Scanner;

public class Ok {
    public static int Fib(int num) {
        if (num == 0 || num == 1)
            return num;
        else
            return Fib(num - 2) + Fib(num - 1);
    }

    public static void main(String[] args) {
        System.out.println(Fib(6));

    }
}
import java.util.Scanner;
public class Ok {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        float num = input.nextFloat();
        float sum = 0;
        for (float i = 0; i <= 28; i++) {
            sum = sum + num;
            num = num + 0.07f;
            System.out.printf("The num=:%f", num);
            System.out.println();
        }
        System.out.println("The sum of series:" + (int) sum);
    }
}

import java.util.Scanner;

public class Ok {

    // a method to find the greatest common divisor.
    // of given tv numbers.
    public static int GCD(int num1, int num2) {
        int gcd = 0, x = 0;
        if (num1 > num2) {
            x = num1 / num2;
            gcd = num1 - (num2 * x);
        }
        if (num2 > num1) {
            x = num2 / num1;
            gcd = num2 - (num2 * x);
        }
        return gcd;

    }

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int num1, num2;
        System.out.println("Enter numer1:");
        num1 = input.nextInt();
        System.out.println("Enter number2:");
        num2 = input.nextInt();
        System.out.println("gcd=" + GCD(num1, num2));

    }

}
import java.util.Scanner;

//write a program that computes weekly hours for each employee;
//Use a two-dimensional array.Each row records an employee's
//seven-day work hours with seven columns. 
public class Ok {
    public static int[] Sumhours(int[][] hours) {

        int TotalHoursForEachEmployee[] = new int[hours.length];
        for (int i = 0; i < hours.length; i++) {
            int sum = 0;
            for (int j = 0; j < hours[i].length; j++) {
                sum += hours[i][j];
            }
            TotalHoursForEachEmployee[i] = sum;
        }
        return TotalHoursForEachEmployee;
    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int Employeeworkhours[][] = new int[7][7];
        System.out.println("Enter employee work hours:");

        for (int i = 0; i < Employeeworkhours.length; i++) {
            for (int j = 0; j < Employeeworkhours[i].length; j++) {
                Employeeworkhours[i][j] = in.nextInt();
            }
        }
        int total[] = Sumhours(Employeeworkhours);
        for (int i = 0; i < total.length; i++) {
            System.out.println("employee work hours:" + (i + 1) + "=");
            System.out.println(total[i]);
        }
    }
}
import java.util.Scanner;

//write a program that computes weekly hours for each employee;
//Use a two-dimensional array.Each row records an employee's
//seven-day work hours with seven columns. 

public class Ok {
    public static int[] Sumhours(int[][] hours) {

        int TotalHoursForEachEmployee[] = new int[hours.length];
        for (int i = 0; i < hours.length; i++) {
            int sum = 0;
            for (int j = 0; j < hours[i].length; j++) {
                sum += hours[i][j];
            }
            TotalHoursForEachEmployee[i] = sum;
        }
        return TotalHoursForEachEmployee;

    }

    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int Employeeworkhours[][] = new int[7][7];
        System.out.println("Enter employee work hours:");

        for (int i = 0; i < Employeeworkhours.length; i++) {
            for (int j = 0; j < Employeeworkhours[i].length; j++) {
                Employeeworkhours[i][j] = in.nextInt();
            }
            ;
        }
        ;

        int total[] = Sumhours(Employeeworkhours);
        for (int i = 0; i < total.length; i++) {
            System.out.println("employee work hours:" + (i+1) + "=");
            System.out.println(total[i]);
        }
        ;
    };
};
//import java.util.Scanner;

//write a program that computes weekly hours for each employee;
//Use a two-dimensional array.Each row records an employee's
//seven-day work hours with seven columns. 

public class Ok {
    public static int[] Sumhours(int[][] hours) {

        int TotalHoursForEachEmployee[] = new int[hours.length];
        for (int i = 0; i < hours.length; i++) {
            int sum = 0;
            for (int j = 0; j < hours[i].length; j++) {
                sum += hours[i][j];
            }
            TotalHoursForEachEmployee[i] = sum;
        }
        return TotalHoursForEachEmployee;

    }

    public static void main(String[] args) {
        // Scanner in = new Scanner(System.in);
        // int Employeeworkhours[][] = new int[7][7];
        int[][] Employeeworkhours = { 
        { 1, 2, 3, 4, 5, 6, 7 },
        { 8, 9, 10, 11, 12, 13, 14 },
        { 15, 16, 17, 18, 19, 20, 21 },
        { 22, 23, 24, 25, 26, 27, 28 },
        { 29, 30, 31, 32, 33, 34, 35 },
        { 36, 37, 38, 39, 40, 41, 42 },
        { 10, 20, 30, 40, 50, 60, 70 } };
        /*
         * for (int i = 0; i < Employeeworkhours.length; i++) { for (int j = 0; j <
         * Employeeworkhours[i].length; j++) { Employeeworkhours[i][j] = in.nextInt(); }
         * }
         */
        int total[] = Sumhours(Employeeworkhours);
        for (int i = 0; i < total.length; i++) {
            System.out.println(total[i]);
        }
    };
};
import java.util.Scanner;

//Write a program that reads an unspecified number of scores and,
//determines how many scores are above or equal to the average and how many,
//scores are below the average. Enter a negative number to signify the end of the,
//input. Assume that the maximum number of scores is (10),

public class Ok {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter Scores:(negative number signifies end):");
        int scores[] = new int[10];
        int numberofScores = 0;
        int average = 0;
        for (int i = 0; i < 10; i++) {
            scores[i] = input.nextInt();
            if (scores[i] < 0)
                break;
            average += scores[i];
            numberofScores++;
        }
        average /= numberofScores;
        int AboveOREqual = 0, below = 0;
        for (int i = 0; i < numberofScores; i++) {
            if (scores[i] >= average) {
                AboveOREqual++;
            } else {
                below++;
            }
        }
        System.out.println("\n Average of scores:" + average);
        System.out.println("Number of scores above or equal to average:" + AboveOREqual);
        System.out.println("Number of scores below average:" + below);

    };
};
import java.util.Scanner;

//Write a program that reads an unspecified number of scores and,
//determines how many scores are above or equal to the average and how many,
//scores are below the average. Enter a negative number to signify the end of the,
//input. Assume that the maximum number of scores is (10),
public class Ok {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.print("Enter Scores:(negative number signifies end):");
        int scores[] = new int[10];
        int numberofScores = 0;
        int average = 0;
        for (int i = 0; i < 10; i++) {
            scores[i] = input.nextInt();
            if (scores[i] < 0)
                break;
            average += scores[i];
            numberofScores++;
        }
        average /= numberofScores;
        int AboveOREqual = 0, below = 0;
        for (int i = 0; i < numberofScores; i++) {
            if (scores[i] >= average) {
                AboveOREqual++;
            } else {
                below++;
            }
        }
        System.out.println("\n Average of scores:" + average);
        System.out.println("Number of scores above or equal to average:" + AboveOREqual);
        System.out.println("Number of scores below average:" + below);

    };
};
public class Ok {
    public static void main(String[] args) {
        System.out.println("\n\n    1   2   3   4   5   6   7   8   9   10");// tab.
        System.out.println("----------------------------------------------");

        for (int i = 1; i <= 10; i++) {
            if (i < 10) {
                System.out.print(i + " |");
            } else {
                System.out.print(i + "|");
            }
            for (int j = 1; j <= 10; j++) {
                int z = i * j;
                if (z >= 10) {
                    System.out.print(z + "  ");
                } else {
                    System.out.print(z + "   ");
                }
            }
            System.out.println();
        }

    };

}
import java.util.Scanner;

//Some websites impose certain rules for passwords,
//Write a java program that checks whether a string is valid passwords,
//suppose the password rule is as follows,
//A password must have at least eight characters,
//A password consists of only letters and digits, 
//A password must contain at least two digits,
//your program prompts the user to enter a password and displays"valid password",
//if the rule is followed or"invalid password otherwise",

public class Ok {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter the password:");
        String password = input.next();
        System.out.println(password.length());
        if (isLeastEightChara(password) && isContainLeastTwoDigits(password) && isOnlyLettersandDigits(password)) {
            System.out.println("Valid password");
        } else {
            System.out.println("inValid password");
        }
        System.out.println(isLeastEightChara(password));
        System.out.println(isContainLeastTwoDigits(password));
        System.out.println(isOnlyLettersandDigits(password));

    }

    public static boolean isLeastEightChara(String password) {
        if (password.length() >= 8) {
            return true;
        } else {
            return false;
        }
    };

    public static boolean isContainLeastTwoDigits(String password) {
        int count = 0;
        for (int i = 0; i < password.length(); i++) {
            char pass = password.charAt(i);
            if (Character.isDigit(pass)) {
                count++;
            }
        }
        if (count >= 2) {
            return true;
        } else {
            return false;
        }
    };

    public static boolean isOnlyLettersandDigits(String password) {
        boolean ahmed = false;
        for (int i = 0; i < password.length(); i++) {
            char pass = password.charAt(i);
            if (Character.isDigit(pass)) {
                ahmed = true;
            } else if (Character.isAlphabetic(pass)) {
                ahmed = true;
            } else {
                ahmed = false;
            }
        }
        return ahmed;
    };

}
//Some websites impose certain rules for passwords,
//Write a java program that checks whether a string is valid passwords,
//suppose the password rule is as follows,
//A password must have at least eight characters,
//A password consists of only letters and digits, 
//A password must contain at least two digits,
//your program prompts the user to enter a password and displays"valid password",
//if the rule is followed or"invalid password otherwise",

public class Ok {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter the password:");
        String password = input.next();
        System.out.println(password.length());
        if (isLeastEightChara(password) && isContainLeastTwoDigits(password) && isOnlyLettersandDigits(password)) {
            System.out.println("Valid password");
        } else {
            System.out.println("inValid password");
        }
        System.out.println(isLeastEightChara(password));
        System.out.println(isContainLeastTwoDigits(password));
        System.out.println(isOnlyLettersandDigits(password));

    }
    public static boolean isLeastEightChara(String password) {
        if (password.length() >= 8) {
            return true;
        } else {
            return false;
        }
    };

    public static boolean isContainLeastTwoDigits(String password) {
        int count = 0;
        for (int i = 0; i < password.length(); i++) {
            char pass = password.charAt(i);
            if (Character.isDigit(pass)) {
                count++;
            }
        }
        if (count >= 2) {
            return true;
        } else {
            return false;
        }
    };
    public static boolean isOnlyLettersandDigits(String password) {
        boolean ahmed = false;
        for (int i = 0; i < password.length(); i++) {
            char pass = password.charAt(i);
            if (Character.isDigit(pass)) {
                ahmed = true;
            } else if (Character.isAlphabetic(pass)) {
                ahmed = true;
            } else {
                ahmed = false;
            }
        }
        return ahmed;
    };

}
import java.util.Scanner;

//Some websites impose certain rules for passwords,
//Write a java program that checks whether a string is valid passwords,
//suppose the password rule is as follows,
//A password must have at least eight characters,
//A password consists of only letters and digits, 
//A password must contain at least two digits,
//your program prompts the user to enter a password and displays"valid password",
//if the rule is followed or"invalid password otherwise",

public class Ok {
    public static void main(String[] args) {
        Scanner input=new Scanner(System.in);
        System.out.println("Enter the password:");
        String password=input.next();
        if(isLeastEightChara(password)&&isContainLeastTwoDigits(password)&&isOnlyLettersandDigits(password))
        {
            System.out.println("Valid password");
        }
        else
        {
            System.out.println("inValid password");

        }

        

    }
    public static boolean isLeastEightChara(String password)
    {
        if(password.length()<=8)
        {
            return true;
        }
        else
        {
            return false;
        }
    };
    public static boolean isContainLeastTwoDigits(String password)
    {
        int count=0;
        for(int i=0;i<password.length();i++)
        {
        char pass=password.charAt(i);
        if(Character.isDigit(pass))
        {
            count++;
        }
        }
        if(count>=2)
        {
            return true;
        }
        else
        {
            return false;
        }
    };
    public static boolean isOnlyLettersandDigits(String password){
        boolean a=false;
        for(int i=0;i<password.length();i++){
        char pass=password.charAt(i);
        if(Character.isDigit(pass)&&Character.isAlphabetic(pass)){
            a=true;
        }
        return a;
    }
    
}
    
}
public class Amazon {
    public static void main(String[] args) {
        String str = "ABCD";
        System.out.println(str);
    }
}
public class Amazon {

    public static void main(String[] args) {
        String str = new String("ABCD");
        System.out.println(str);
    }
}
public class Amazon {

    public static void main(String[] args) {
        String str = new String("ABCD");
        System.out.println(str);
        //class methods
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "Hello";
        str = str.concat(str);
        System.out.println(str);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "Hello";
        str = str.concat(", I'm Ahmed");
        System.out.println(str);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "Hello";
        str = str + ", I'm Ahmed";
        System.out.println(str);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "Hello";
        str = str + ", I'm Ahmed";
        System.out.println(str);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "Hello";//have same address
        String str2 = "Hello";//have same address
        System.out.println(str1);
        System.out.println(str2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "Hello";// have same address
        String str2 = "Hello";// have same address
        String str3 = "AAAAA";
        str1 = "12345";
        System.out.println(str1);
        System.out.println(str2);
        // System.out.println(str3);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "Hello";// have same address
        String str2 = "Hello";// have same address
        String str3 = "AAAAA";
        str1 = "12345";
        System.out.println(str1);
        System.out.println(str2);
        // System.out.println(str3);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "Hello";// have same address
        String str2 = "Hello";// have same address
        String str3 = "AAAAA";
        str1 = "12345";
        System.out.println(str1);
        System.out.println(str2);
        // System.out.println(str3);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCD";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCD";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));
        /*
         * s1>s2=+num, s1<s2=-num, s1=s2=0
         */
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCD";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));
        /*
         * s1>s2=+num, s1<s2=-num, s1=s2=0
         */
       System.out.println((int) 'A' + (int) 'B' + (int) 'C' + (int) 'D');
       System.out.println((int) 'A' + (int) 'B' + (int) 'C' + (int) 'e');
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCD";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));
        System.out.println((int) 'D');
        System.out.println((int) 'e');
        /*
         * s1>s2=+num, s1<s2=-num, s1=s2=0
         */
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "ABCe";
        String s2 = "ABCe";
        System.out.println(s1.compareTo(s2));

    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "   hello   ";
        System.out.println(str1 + "how are you");
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "   hello   ";
        System.out.println(str1.trim() + "how are you");
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "   hello   ";
        System.out.println(str1.trim() + "how are you");
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "HEllo I'm Belal";
        System.out.println(str1.toLowerCase());
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "HEllo I'm Belal";
        System.out.println(str1.toLowerCase());
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str1 = "HEllo I'm Belal";
        System.out.println(str1.toLowerCase());
    }
}
public class Amazon {
    public static void main(String[] args) {
        int n = 10;
        String str1 = String.valueOf(n);
        System.out.println(str1);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int n = 10;
        String str1 = n + "";
        System.out.println(str1);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "HELLO";
        String s2 = "HELLO";
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "HELLO";
        String s2 = "HELLO";
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1 == s2);//address
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1.equals(s2));//address
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        System.out.println(s1.equals(s2));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        s1 = s2;
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = new String("HELLO");
        String s2 = new String("HELLO");
        s1 = s2;
        System.out.println(s1 == s2);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "HELLO";
        String s2 = "hello";
        System.out.println(s1.equalsIgnoreCase(s2));
    }
}
public class Amazon {

    public static void main(String[] args) {
        String s1 = "HELLO";
        String s2 = "hello";
        System.out.println(s1.equalsIgnoreCase(s2));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1="Hey, Welcome to c++ course";
        String replaceString=s1.replace(target, replacement)
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "Hey, Welcome to c++ course";
        String replaceString = s1.replace("c++", "JAVA");
        System.out.println(replaceString);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "Hey, Welcome to c++ course";
        String replaceString = s1.replace("c++", "JAVA");
        System.out.println(replaceString);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "Hey, Welcome to c++ course c++";
        String replaceString = s1.replace("c++", "JAVA");
        System.out.println(replaceString);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String name="hello how are you doing";
        System.out.println(name.contains("how are you"));
        System.out.println(name.contains("hello"));
        System.out.println(name.contains("fine"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String name = "hello how are you doing";
        System.out.println(name.contains("how are you"));
        System.out.println(name.contains("hello"));
        System.out.println(name.contains("fine"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String name = "hello how are you doing";
        System.out.println(name.contains(" you"));
        System.out.println(name.contains("hello"));
        System.out.println(name.contains("fine"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "hello how are you";
        System.out.println(s1.endsWith("u"));
        System.out.println(s1.endsWith("you"));
        System.out.println(s1.endsWith("how"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String s1 = "hello how are you";
        System.out.println(s1.endsWith("u"));
        System.out.println(s1.endsWith("you"));
        System.out.println(s1.endsWith("how"));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String ahmed1 = "Ahmed Abdelmoneim";
        System.out.println(ahmed1.substring(0));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String ahmed1 = "Ahmed Abdelmoneim";
        System.out.println(ahmed1.substring(2));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String ahmed1 = "Ahmed Abdelmoneim";
        System.out.println(ahmed1.substring(2, 8));
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "AA-BB-CC-DD-EE-FF";
        for (String val : str.split("-")) {
            System.out.println(val);
        }
        ;
    }
}
public class Amazon {
    public static void main(String[] args) {
        String str = "AA BB CC DD EE FF";
        for (String val : str.split(" ")) {
            System.out.println(val);
        }
    }
}




















import java.util.Scanner;

public class Amazon {
    public static void main(String[] args) {
        int arr[][]=new int[3][];
        arr[0]=new int[4];
        arr[1]=new int[4];
        arr[2]=new int[4];

        arr[0][0]=1;
        arr[0][1]=2;
        arr[0][2]=3;
        arr[0][3]=4;

        arr[1][0]=10;
        arr[1][1]=20;
        arr[1][2]=30;
        arr[1][3]=40;

        arr[2][0]=50;
        arr[2][1]=60;
        arr[2][2]=70;
        arr[2][3]=80;
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int arr[][] = new int[3][4];
        /*
         * arr[0]=new int[4];
         * arr[1]=new int[4];
         * arr[2]=new int[4];
         */
        arr[0][0] = 1;
        arr[0][1] = 2;
        arr[0][2] = 3;
        arr[0][3] = 4;

        arr[1][0] = 10;
        arr[1][1] = 20;
        arr[1][2] = 30;
        arr[1][3] = 40;

        arr[2][0] = 50;
        arr[2][1] = 60;
        arr[2][2] = 70;
        arr[2][3] = 80;
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int arr[][] = new int[][]{
            {1,5,8},
            {5,6},
            {4}};
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int arr[][] = { { 1, 5, 8 }, { 5, 6 }, { 4 } };
        System.out.println(arr.length);
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int arr[][] = { { 1, 5, 8 }, { 5, 6 }, { 4 } };
        System.out.println(arr.length);
        System.out.println(arr[0].length);
        System.out.println(arr[1].length);
        System.out.println(arr[2].length);
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int arr[][] = { { 1, 5, 8 }, { 5, 6 }, { 4 } };
        System.out.println(arr.length);
        System.out.println(arr[0].length);
        System.out.println(arr[1].length);
        System.out.println(arr[2].length);
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int[][] arr = { { 1, 5, 8 }, { 5, 6 }, { 4 } };
        for (int i = 0; i < arr[0].length; i++) {
            System.out.println(arr[i] + " ");
        }
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int[][] arr = { { 1, 5, 8 }, { 5, 6 }, { 4 } };
        for (int i = 0; i < arr[0].length; i++) {
            System.out.println(arr[0][i] + " ");
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[][] arr = { { 1, 5, 8 }, { 5, 6 }, { 4 } };
        for (int row = 0; row < arr.length; row++) {
            for (int col = 0; col < arr[row].length; col++) {
                System.out.print(arr[row][col] + " ");
            }
            System.out.println();
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[][] arr = { { 1, 5, 8 }, { 5, 6 }, { 4 } };
        for (int row = 0; row < arr.length; row++) {
            for (int col = 0; col < arr[row].length; col++) {
                System.out.print(arr[row][col] + " ");
            }
            System.out.println();
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[][] arr = { { 1, 5, 8 }, { 5, 6 }, { 4 } };
        for (int[] r : arr) {
            for (int c : r) {
                System.out.print(c + " ");
            }
            System.out.println();
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[][] arr = { { 1, 3, 5 }, { 2, 4, 6 } };// 2 X 3 transpose matrix.
        for (int i = 0; i < arr.length; i++) {
            for (int j = 0; j < arr[i].length; j++) {
                System.out.print(arr[i][j] + " ");
            }
            System.out.println();
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[][] arr = { { 1, 3, 5 }, { 2, 4, 6 } };// 2 X 3 transpose matrix.
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 2; j++) {
                System.out.print(arr[j][i] + " ");
            }
            System.out.println();
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[][] arr = { { 1, 3, 5 }, { 2, 4, 6 } };// 2 X 3 transpose matrix.
        for (int i = 0; i < 3; i++) {
            for (int j = 0; j < 2; j++) {
                System.out.print(arr[j][i] + " ");
            }
            System.out.println();
        }
    }
}
public class Amazon {

    static void print(int a[][]) {
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {
                System.out.print(a[i][j] + " ");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        int[][] arr = { { 1, 3, 5 }, { 2, 4, 6 } };
        print(arr);

    }
}
public class Amazon {

    static void print(int a[][]) {
        for (int i = 0; i < a.length; i++) {
            for (int j = 0; j < a[i].length; j++) {
                System.out.print(a[i][j] + " ");
            }
            System.out.println();
        }
    }

    public static void main(String[] args) {
        int[][] arr = { { 1, 3, 5 }, { 2, 4, 6 } };
        print(arr);

    }
}
public class Amazon {

    static int[][] get2Array() {
        int arr[][]=new int [2][3];
        return arr;
    }

    public static void main(String[] args) {
        



    }
}




public class Amazon {
    static void printArray(int[] x) {
        for (int i = 0; i < x.length; i++) {
            System.out.println(x[i]);
        }

    }

    public static void main(String[] args) {
        int arr[] = { 1, 2, 3, 4 };
        printArray(arr);
    }
}
public class Amazon {
    static void printArray(int[] x) {
        for (int i = 0; i < x.length; i++) {
            System.out.println(x[i]);
        }

    }

    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3, 4 };
        int arr2[] = { 5, 6, 7, 8 };
        printArray(arr2);
    }
}
public class Amazon {
    static void printArray(int[] x) {
        for (int i = 0; i < x.length; i++) {
            System.out.println(x[i]);
        }
    }
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3, 4 };
        int arr2[] = { 5, 6, 7, 8 };
        int x[] = new int[] { 1, 2, 3 };
        printArray(new int[] { 1, 2, 3 });
    }
}
public class Amazon {
    static void printArray(int[] x) {
        for (int i = 0; i < x.length; i++) {
            System.out.println(x[i]);
        }
    }
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3, 4 };
        int arr2[] = { 5, 6, 7, 8 };
        int x[] = new int[] { 1, 2, 3 };
        printArray(new int[] { 1, 2, 3 });
        printArray(x);
    }
}
import java.util.Scanner;

public class Amazon {

    static int[] getArray() {
        return new int[] { 20, 40, 60, 80 };
    }

    static void printArray(int[] x) {
        for (int i = 0; i < x.length; i++) {
            System.out.println(x[i]);
        }

    }

    public static void main(String[] args) {
        int z[] = getArray();
        printArray(z);
    }
}
import java.util.Scanner;

public class Amazon {

    static int[] getArray() {
        return new int[] { 20, 40, 60, 80 };
    }

    static void printArray(int[] x) {
        for (int i = 0; i < x.length; i++) {
            System.out.println(x[i]);
        }

    }

    public static void main(String[] args) {
        int z[] = getArray();
        printArray(z);
    }
}
import java.util.Scanner;
public class Amazon {
    static int[] getArray() {
        return new int[] { 20, 40, 60, 80 };
    }

    static void printArray(int[] x) {
        for (int i = 0; i < x.length; i++) {
            System.out.println(x[i]);
        }

    }
    public static void main(String[] args) {
        int z[] = getArray();
        printArray(z);
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3 };
        int arr2[] = { 40, 50, 60 };
        arr1 = arr2;
        arr2[0] = 100;
        arr1[1] = 500;
        System.out.println(arr1[0]);
        System.out.println(arr2[2]);
    }
}
import java.util.Scanner;
public class Amazon {
    static void setArray(int[] x) {
        x[0] = 50;
    }
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3, 4 };
        setArray(arr1);
        System.out.println(arr1[0]);
    }
}
import java.util.Scanner;
public class Amazon {
    static void setArray(int[] x) {
        x[0] = 50;
    }
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3, 4 };
        setArray(arr1);
        System.out.println(arr1[0]);
    }
}
import java.util.Scanner;
public class Amazon {
    static void setArray(int[] x) {
        x[0] = 50;
    }
    static void serVar(int x) {
        x = 10;
    }
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3, 4 };
        setArray(arr1);
        System.out.println(arr1[0]);
        int y = 5;
        serVar(y);
        System.out.println(y);
    }
}
import java.util.Scanner;
public class Amazon {
    static void setArray(int[] x) {
        x[0] = 50;
    }
    static void serVar(int x) {//&cant use in java
        x = 10;
    }
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3, 4 };
        setArray(arr1);
        System.out.println(arr1[0]);
        int y = 5;
        serVar(y);
        System.out.println(y);
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3 };
        int arr2[] = { 40, 50, 60 };
        int arr3[] = { 40, 50, 60 };
        arr1 = arr2 = arr3;
        arr1[0] = 0;
        System.out.println(arr1[0]);
        System.out.println(arr2[0]);
        System.out.println(arr3[0]);
    }
}
import java.util.Scanner;
public class Amazon {
    public static void main(String[] args) {
        int arr1[] = { 1, 2, 3 };
        int arr2[] = { 40, 50, 60 };
        int arr3[] = { 40, 50, 60 };
        arr1 = arr2 = arr3;
        arr1[0] = 0;
        System.out.println(arr1[0]);
        System.out.println(arr2[0]);
        System.out.println(arr3[0]);
    }
}


import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = new char[5];
        ahmedarr[0] = 'a';
        ahmedarr[1] = 'h';
        ahmedarr[2] = 'm';
        ahmedarr[3] = 'e';
        ahmedarr[4] = 'd';
        for (int i = 0; i < ahmedarr.length; i++) {
            System.out.print(ahmedarr[i]);
        }
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = new char[5];
        ahmedarr[0] = 'a';
        ahmedarr[1] = 'h';
        ahmedarr[2] = 'm';
        ahmedarr[3] = 'e';
        ahmedarr[4] = 'd';
        System.out.println(ahmedarr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = { 'a', 'h', 'm', 'e', 'd' };
        System.out.println(ahmedarr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = { 97, 98 };
        System.out.println(ahmedarr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = { 97, 98 };//using ASC code
        System.out.println(ahmedarr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = { 65, 66 };// using ASC code
        System.out.println(ahmedarr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = { 65, 66 };// using ASC code
        System.out.println(ahmedarr);
        System.out.println(((char)66);//Type Casting
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = { 65, 66 };// using ASC code
        System.out.println(ahmedarr);
        System.out.println((char) 66);// Type Casting
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char ahmedarr[] = { 65, 66 };// using ASC code
        System.out.println(ahmedarr);
        System.out.println((char) 66);// Type Casting
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        char arrchar[] = new char[size];
        arrchar = input.next().toCharArray();
        System.out.println(arrchar);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();
        char arrchar[] = new char[size];
        arrchar = input.next().toCharArray();
        System.out.println(arrchar);
    }
}
import java.util.Arrays;
import java.util.Scanner;

/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[6];
        Scanner input = new Scanner(System.in);
        arr = input.nextLine().toCharArray();
        System.out.println(arr);
    }
}
import java.util.Arrays;
import java.util.Scanner;

/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[6];
        Scanner input = new Scanner(System.in);
        arr = input.nextLine().toCharArray();
        System.out.println(arr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[20];
        Scanner input = new Scanner(System.in);
        String str = input.nextLine();
        arr = str.toCharArray();
        System.out.println(arr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[20];
        Scanner input = new Scanner(System.in);
        String str = input.nextLine();
        arr = str.toCharArray();
        System.out.println(arr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[]=new char[]{'C','B','A'};
        Arrays.sort(arr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[] { 'C', 'B', 'A' };
        Arrays.sort(arr);
        System.out.println(arr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[] { 'C', 'B', 'A' };
        Arrays.sort(arr);
        System.out.println(arr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[] { 'a', 'C', 'A' };
        Arrays.sort(arr);
        System.out.println(arr);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[] { 'a', 'b', 'c', 'd', 'e' };
        String str = new String(arr, 0, 2);
        System.out.println(str);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[] { 'a', 'b', 'c', 'd', 'e' };
        String str = new String(arr, 2, 3);
        System.out.println(str);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[] = new char[] { 'a', 'b', 'c', 'd', 'e' };
        String str = new String(arr, 2, 3);
        System.out.println(str);
    }
}
import java.util.Arrays;
import java.util.Scanner;

/*
Char Array.
*/
public class Amazon {
    public static void main(String[] args) {
        char arr[]=new char[]{'a','b','c','d','e'};
        String str="abcde";
    }
}

//array of char can Encrypt.






//Arrays (one_Dimensional Arrays)
/*
Write a java program to sum values of an array.
*/
public class Amazon {
    public static void main(String[] args) {
        int ahmedarr[] = { 1, 5, 8, 9 };
        int sum = 0;
        for (int i = 0; i < ahmedarr.length; i++) {
            sum = sum + ahmedarr[i];
        }
        System.out.println("The Sum=" + sum);
    }
}
//Arrays (one_Dimensional Arrays)
/*
Write a java program to sum values of an array.
*/
public class Amazon {
    public static void main(String[] args) {
        int ahmedarr[] = { 1, 5, 8, 9 };
        int sum = 0;
        for (int i = 0; i < ahmedarr.length; i++) {
            sum = sum + ahmedarr[i];//sum+=ahmedarr[i];
        }
        System.out.println("The Sum=" + sum);
    }
}
import java.util.Scanner;
/*
Write a Java program to calculate:
the average value of array elements.
*/
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter size number:");
        int size = input.nextInt();
        int arrnumber[] = new int[size], sum = 0;
        for (int i = 0; i < arrnumber.length; i++) {
            arrnumber[i] = input.nextInt();
        }
        for (int j = 0; j < arrnumber.length; j++) {
            sum += arrnumber[j];
        }
        System.out.println("The Average =="+(sum/size));
    }
}
import java.util.Scanner;
/*
Write a Java program to calculate:
the average value of array elements.
*/
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter size number:");
        int size = input.nextInt();
        int arrnumber[] = new int[size], sum = 0;
        for (int i = 0; i < arrnumber.length; i++) {
            arrnumber[i] = input.nextInt();
        }
        for (int j = 0; j < arrnumber.length; j++) {
            sum += arrnumber[j];
        }
        System.out.println("The Average ==" + (sum / size));
      //can double
    }
}
import java.util.Scanner;
/*
Write a Jave program to test: 
if an array contains a specific Value
*/
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter the specific num:");
        int num = input.nextInt();
        System.out.println("Enter the size:");
        int size = input.nextInt();
        int ahmed[] = new int[size];
        System.out.println("Enter the array values:");
        for (int i = 0; i < size; i++) {
            ahmed[i] = input.nextInt();
        }
        boolean f = false;
        for (int i : ahmed) {
            if (num == i) {
                f = true;
                break;
            }
        }
        System.out.println("array contains a specific value?");
        if (f) {
            System.out.println("Found");
        } else {
            System.out.println("Not Found");
        }
    }
}
/*
Write a Jave program to test: 
if an array contains a specific Value
*/
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter the specific num:");
        int num = input.nextInt();
        System.out.println("Enter the size:");
        int size = input.nextInt();
        int ahmed[] = new int[size];
        System.out.println("Enter the array values:");
        for (int i = 0; i < size; i++) {
            ahmed[i] = input.nextInt();
        }
        boolean f = false;
        for (int i : ahmed) {
            if (num == i) {
                f = true;
                break;
            }
        }
        System.out.println("array contains a specific value?");
        if (f) {
            System.out.println("Found");
        } else {
            System.out.println("Not Found");
        }
    }
}
import java.util.Scanner;
/*
Write a Java program to find the maximum
and minimum value of an array.
*/
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter the size:");
        int size = input.nextInt();
        int ahmedarr[] = new int[size];
        System.out.println("Enter the array elements:");
        for (int i = 0; i < ahmedarr.length; i++) {
            ahmedarr[i] = input.nextInt();
        }
        int minimum = ahmedarr[0], maxmum = ahmedarr[0];
        for (int i = 1; i < ahmedarr.length; i++) {
            if (ahmedarr[i] < minimum) {
                minimum = ahmedarr[i];
            }
            if (ahmedarr[i] > maxmum) {
                maxmum = ahmedarr[i];
            }
        }
        System.out.println("Minimum value==" + minimum);
        System.out.println("Maxmum value==" + maxmum);
    }
}
/*
Write a Java program to find the maximum
and minimum value of an array.
*/
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter the size:");
        int size = input.nextInt();
        int ahmedarr[] = new int[size];
        System.out.println("Enter the array elements:");
        for (int i = 0; i < ahmedarr.length; i++) {
            ahmedarr[i] = input.nextInt();
        }
        int minimum = ahmedarr[0], maxmum = ahmedarr[0];
        for (int i = 1; i < ahmedarr.length; i++) {
            if (ahmedarr[i] < minimum) {
                minimum = ahmedarr[i];
            }
            if (ahmedarr[i] > maxmum) {
                maxmum = ahmedarr[i];
            }
        }
        System.out.println("Minimum value==" + minimum);
        System.out.println("Maxmum value==" + maxmum);
    }
}
import java.util.Arrays;
import java.util.Scanner;
/*
Write a Java program to sort a numeric array.
*/
public class Amazon {
    public static void main(String[] args) {
        int ahmedarray[] = { 1, 2, 3, 4, 5, 6, 7, 8, -9 };
        Arrays.sort(ahmedarray);//arrangement
        for (int i = 0; i < ahmedarray.length; i++) {
            System.out.print(ahmedarray[i] + " ");
        }
    }
}//Arrays sort()arrangement.





//Arrays (One-Dimensional):
/*
An array is a Container object that holds a fixed 
number of values of a single data type.
*/
public class MedoClass {
    public static void main(String[] args) {
        int []num=new int[5];
        num[0]=15;
        System.out.print(num[0]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[] num = new int[5];
        num[0] = 10;
        num[1] = 30;
        System.out.println(num[1]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[] num = new int[5];
        num[0] = 10;
        num[1] = 20;
        num[2] = 30;
        num[3] = 40;
        num[4] = 50;
        System.out.println(num[4]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int[] num = new int[5];//take from zero to four.
        num[0] = 10;
        num[1] = 20;
        num[2] = 30;
        num[3] = 40;
        num[4] = 50;
        num[5] = 60;//Error 
        System.out.println(num[5]);//Error
    }
}
public class Amazon {
    public static void main(String[] args) {
        int num[] = new int[5];
        num[0] = 10;
        num[1] = 20;
        num[2] = 30;
        num[3] = 40;
        num[4] = 50;
        num[5] = 60;
        System.out.println(num[5]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int num[]; 
        num=new int[5];
        num[0] = 10;
        num[1] = 20;
        num[2] = 30;
        num[3] = 40;
        num[4] = 50;
        num[5] = 60;
        System.out.println(num[5]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int num[] = { 1, 8, 9, 5 };
        System.out.println(num[0] + " " + num[1]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int num[] = { 1, 8, 9, 5 };
        num[0] = 55;
        System.out.println(num[0] + " " + num[1]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int num[] = { 1, 8, 9, 5 };
        num[7] = 55;//error size equal 4
        System.out.println(num[0] + " " + num[1]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        int num[] = { 1, 8, 9, 5 };
        System.out.println(num.length);
    }
}
public class Amazon {
    public static void main(String[] args) {
        double arr[] = new int[6];//Error
        System.out.println();
    }
}
public class Amazon {
    public static void main(String[] args) {
        double arr[] = new double[6];
        System.out.println(arr[0]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        double arr[] = new double[6];
        System.out.println(arr[0]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        boolean arr[] = new boolean[6];
        System.out.println(arr[1]);//false default
    }
}
public class Amazon {
    public static void main(String[] args) {
        char[] arr = new char[6];
        System.out.println(arr[1]);//Null means having no value
    }
}
public class Amazon {
    public static void main(String[] args) {
        char[] arr = new char[6];
        arr[0] = 'a';
        arr[1] = 'b';
        arr[2] = 'c';
        arr[3] = 'd';
        arr[4] = 'e';
        arr[5] = 'f';
        System.out.println(arr[1]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String arr[] = new String[6];
        System.out.println(arr[0]);//null
    }
}
public class Amazon {
    public static void main(String[] args) {
        String arr1[] = new String[] { "Ali", "Ahmed", "Belal" };
        System.out.println(arr1[0]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String arr1[] = { "Ali", "Ahmed", "Belal" };
        System.out.println(arr1[0]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String arr[] = new String[] { "Ali", "Ahmed", "Belal" };
        System.out.println(arr[0]);
        System.out.println(arr[1]);
        System.out.println(arr[2]);
    }
}
public class Amazon {
    public static void main(String[] args) {
        String arr[] = new String[] { "Ali", "Ahmed", "Belal" };
        for (int i = 0; i < arr.length; i++) {
            System.out.println(arr[i]);
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        String arr[] = new String[] { "Ali", "Ahmed", "Belal" };
        for (int i = 0; i < arr.length; i++) {//i must = 1.
            System.out.println(arr[i]);
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        String arr[] = new String[] { "Ali", "Ahmed", "Belal" };
        for (String i : arr) {
            System.out.println(i);
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        String arr[] = new String[] { "Ali", "Ahmed", "Belal" };
        for (String i : arr) {
            System.out.println(i);
        }
    }
}
public class Amazon {
    public static void main(String[] args) {
        int size=15;
        int  arr[]=new int[size];
    }
}
public class Amazon {
    public static void main(String[] args) {
        short size = 15;//not double jast size.
        int arr[] = new int[size];
    }
}
public class Amazon {
    public static void main(String[] args) {
        short size = 15;
        int arr[] = new int[size];
        arr[0]=15;
        System.out.println(arr[0]);
    }
}
import java.util.Scanner;
import jdk.tools.jlink.resources.plugins;
public class Amazon {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        short size = input.nextShort();
        int[] arr = new int[size];
        for (short i = 0; i < arr.length; i++) {
            arr[i] = input.nextInt();
        }
        System.out.print("[");
        for (int i : arr) {
            System.out.print(i + ",");
        }
        System.out.print("]");
    }
}











public class MyName {

    public static void main(String[] args) {
        int[] num = new int[5];
        num[0] = 15;
        num[1] = 33;
        System.out.println(num[1]);
    }
}
public class MyName {
    public static void main(String[] args) {
        int[] num = new int[5];
        num[0] = 15;
        num[1] = 33;
        num[2] = 52;
        num[3] = 85;
        num[4] = 55;
        System.out.println(num[4]);
    }
}
public class MyName {
    public static void main(String[] args) {
        int num[] = { 1, 8, 9, 5 };
        System.out.println(num[0] + " " + num[1]);
    }
}
public class MyName {
    public static void main(String[] args) {
        int num[] = { 1, 8, 9, 5 };
        System.out.println(num[0] + " " + num[1]);

    }
}
public class MyName {
    public static void main(String[] args) {
        int num[] = { 1, 8, 9, 5 };
        System.out.println(num[0] + " " + num[1]);
        num[0] = 55;
        System.out.println(num[0]);
    }
}
public class MyName {
    public static void main(String[] args) {
        int num[] = { 1, 8, 9, 5 };
        System.out.println(num[0] + " " + num[1]);
        num[0] = 55;
        System.out.println(num.length);
    }
}
public class MyName {
    public static void main(String[] args) {
        double[] arr = new double[6];
        System.out.println(arr[0]);
    }
}
public class MyName {
    public static void main(String[] args) {
        int[] arr = new int[6];
        System.out.println(arr[0]);
    }
}
public class MyName {
    public static void main(String[] args) {
        //char[] arr = new char[6];
        // char arr[0] = 'a';
        //char arr[5]={'a','b','c','d'}
        System.out.println(arr[0]);
    }
}
public class MyName {
    public static void main(String[] args) {
        String[] arr = { "Ali", "Ahmed", "Belal" };
        System.out.println(arr[0]);
    }
}
public class MyName {
    public static void main(String[] args) {
        String[] arr =new String[] { "Ali", "Ahmed", "Belal" };
        System.out.println(arr[0]);
    }
}
public class MyName {
    public static void main(String[] args) {
        String[] arr = new String[] { "Ali", "Ahmed", "Belal" };
        System.out.println(arr[0]);
        System.out.println(arr[1]);
        System.out.println(arr[2]);
    }
}
public class MyName {
    public static void main(String[] args) {
        String[] arr = { "Ali", "Ahmed", "Belal" };
        /*
         * System.out.println(arr[0]); 
         System.out.println(arr[1]);
         * System.out.println(arr[2]);
         */
        for (String i : arr) {
            System.out.println(i);
        }
    }
}
public class MyName {
    public static void main(String[] args) {
        String[] arr = { "Ali", "Ahmed", "Belal" };
        for (int i = 0; i < arr.length; i++) {
            System.out.println(i);
        }
    }
}
public class MyName {
    public static void main(String[] args) {
        String[] arr = { "Ali", "Ahmed", "Belal" };
        /*
         * for (int i = 0; i < arr.length; i++) { System.out.println(i); }
         */
        for (String i : arr) {
            System.out.println(i);
        }
    }
}
public class MyName {
    public static void main(String[] args) {
        String[] arr = { "Ali", "Ahmed", "Belal" };
        /*
         * for (int i = 0; i < arr.length; i++) { System.out.println(i); }
         */
        for (String i : arr) {
            System.out.println(i);
        }
    }
}
import java.util.Scanner;
public class MyName {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int size = input.nextInt();// short data type
        int[] arr = new int[size];
        arr[0] = 15;
        System.out.println(arr[0]);
    }
}








public class MyName {
    // Fibonacci
    // 0 1 2 3 4 5 6 7 8 9 10...etc.
    // 0 1 1 2 3 5 8 13 21 34 55...etc.
    static int fib(int num) {
        if (num == 0 || num == 1) {
            return num;
        } else {
            return fib(num - 1) + fib(num - 2);
        }
    }
    public static void main(String[] args) {
        System.out.println("fib = " + fib(7));
    }
}
public class MyName {
    static int n1 = 0, n2 = 1, n3;
    static void printfib(int n) {
        if (n > 0) {
            n3 = n1 + n2;
            n1 = n2;
            n2 = n3;
            System.out.println(" " + n3);
            printfib(n - 1);
        }
    }
    public static void main(String[] args) {
        System.out.println(n1 + " " + n2);
        int num = 5;
        printfib(num);
    }
}
public class MyName {
    static int n1 = 0, n2 = 1, n3;
    static void printfib(int n) {
        if (n > 0) {
            n3 = n1 + n2;
            n1 = n2;
            n2 = n3;
            System.out.println(" " + n3);
            printfib(n - 1);
        }
    }
    public static void main(String[] args) {
        System.out.println(n1 + " " + n2);
        int num = 5;
        printfib(num);
    }
}
public class MyName {
    static int sum(int n1, int n2) {
        if (n1 == n2) {
            return n1;
        } else {
            return n1 + sum(n1 + 1, n2);
        }
    }
    public static void main(String[] args) {
        System.out.println("sum = " + sum(4, 6));
    }
}
public class MyName {
    static int sum(int n1, int n2) {
        if (n1 == n2) {
            return n1;
        } else {
            if (n1 < n2) {
                return n1 + sum(n1 + 1, n2);
            } else {
                return n1 + sum(n1 - 1, n2);
            }
        }
    }
    public static void main(String[] args) {
        System.out.println("sum = " + sum(6, 4));
    }
}


public class MyName {
    static void fun() {
        System.out.println("Hi");
        fun();
    }
    public static void main(String[] args) {
        fun();
    }
}
public class MyName {
    static int count = 0;
    static void fun() {
        count++;
        if (count < 5) {
            System.out.println("Hi");
            fun();
        }
    }
    public static void main(String[] args) {
        fun();
    }
}
public class MyName {
    static int count = 0;
    static void fun() {
        count++;
        if (count < 5) {
            System.out.println("Hi");
            fun();
        }
    }
    public static void main(String[] args) {
        fun();
    }
}
public class MyName {
    static int count = 0;
    static void fun() {
        count++;
        if (count < 5) {
            System.out.println("Hi");
            fun();
        }
        count++;//error.
    }
    public static void main(String[] args) {
        fun();
    }
}
public class MyName {
    static int count = 0;
    static void fun() {
        if (count == 5) {// base case
            return;
        }
        count++;
        System.out.println("Hi Ahmed");
        fun();
    }
    public static void main(String[] args) {
        fun();
    }
}
public class MyName {
    static int count = 0;
    static void fun() {
        if (count == 5) {// base case
            return;
        }
        count++;
        System.out.println("Hi Ahmed");
        fun();
    }
    public static void main(String[] args) {
        fun();
    }
}
public class MyName {
    static int fact(int n) {// 5!=5*4*3*2*1
        if (n == 1) {
            return n;
        } else {
            return n * fact(n - 1);
        }
    }
    public static void main(String[] args) {
        System.out.println("fact==" + fact(5));
    }
}
public class MyName {
    static int fact(int n) {// 5!=5*4*3*2*1
        if (n == 1||n==0) {
            return n;
        } else {
            return n * fact(n - 1);
        }
        /*5*fact(4)
        4*fact(3)
        3*fact(2)
        2*fact(1)
        1 
        */
    }
    public static void main(String[] args) {
        System.out.println("fact==" + fact(5));
    }
}
public class MyName {
    static void fun(int n) {
        if (n < 1) {
            return;
        } else {
            System.out.println("# " + n);
            fun(n - 1);
        }
    }
    public static void main(String[] args) {
        fun(5);
    }
}
public class MyName {
    static void fun(int n) {
        if (n < 1) {
            return;
        } else {
            fun(n - 1);
            System.out.println("# " + n);
        }
    }
    public static void main(String[] args) {
        fun(5);
    }
}
public class MyName {
    static int fact(int n) {
        if (n == 1) {//no n==75
            return 1;
        } else {
            return n * fact(n - 1);
        }
    }
    public static void main(String[] args) {
        System.out.println("fact =" + fact(10));//no fact =75
    }
}
public class MyName {
    static void directRecfun(){
        directRecfun();
    }
    static void indirectRecfun1(){
        indirectRecfun2();
    }
    static void indirectRecfun2(){
        indirectRecfun1();
    }
    public static void main(String[] args) {
        
    }
}


public class MyName {
    static int sum(int n1, int n2) {
        return n1 + n2;
    }
    public static void main(String[] args) {
        System.out.println("Sum==" + sum(10, 50));
    }
}
public class MyName {
    static int sum(int n1, int n2) {
        return n1 + n2;
    }
    static float sum(float n1, float n2) {
        return n1 + n2;
    }
    public static void main(String[] args) {
        System.out.println("Sum==" + sum(10, 50));
        System.out.println("Sum==" + sum(10.5f, 50.7f));
    }
}
public class MyName {
    static int sum(int n1, int n2) {
        return n1 + n2;
    }
    static float sum(float n1, float n2) {
        return n1 + n2;
    }
    static float sum(int n1, float n2) {
        return n1 + n2;
    }
    public static void main(String[] args) {
        System.out.println("Sum==" + sum(10, 50));
        System.out.println("Sum==" + sum(10.5f, 50.7f));
        System.out.println("Sum==" + sum(10, 10.5f));
    }
}
public class MyName {
    static float order(float total) {
        return total;
    }
    static float order(float total, int deliverycosts) {
        return total + deliverycosts;
    }
    static float order(float total, int deliverycosts, String promo) {
        return total + deliverycosts - 2;
    }
    public static void main(String[] args) {
        System.out.println(order(15, 3, "Ahmed"));
    }
}
public class MyName {
    static void fun() {
        System.out.println("fun:");
    }
    static void fun(int x) {
        fun();
        System.out.println("x==" + x);
    }
    public static void main(String[] args) {
        fun(15);
    }
}
public class MyName {
    public static void main(int num) {
        System.out.println(num);
    }

    public static void main(String[] args) {
        main(500);
    }
}



import java.util.Scanner;
public class MyName {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("abs==" + Math.abs(-1.1));
    }
}
import java.util.Scanner;
public class MyName {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("ceil==" + Math.ceil(-1.1));
    }
}
import java.util.Scanner;
public class MyName {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("ceil==" + Math.ceil(1.2));
    }
}
import java.util.Scanner;
public class MyName {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("ceil==" + Math.ceil(1.5));
    }
}
import java.util.Scanner;
public class MyName {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("ceil==" + Math.ceil(-1.9));
    }
}
public class MyName {
    public static void main(String[] args) {

        System.out.println("floor==" + Math.floor(1.9));
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("floor==" + Math.floor(-1.9));
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("round==" + Math.round(1.1));
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("round==" + Math.round(1.6));
    }
}
public class MyName {
    public static void main(String[] args) {

        System.out.println("sqrt==" + Math.sqrt(9));
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("sqrt==" + Math.sqrt(100));
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("Power==" + Math.pow(3, 10));
        System.out.println("Power==" + Math.pow(3, 4));
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("random==" + Math.random());//0.0<=value<1.0.
        System.out.println("random==" + Math.random());
    }
}
public class MyName {
    public static void main(String[] args) {
        double r = (Math.random() * ((10 - 1) + 1) + 1);
        // double r = (Math.random() * 11);
        System.out.println("random=" + r);
    }
}
import java.util.Random;
public class MyName {
    public static void main(String[] args) {
        int r = (int) (Math.random() * ((10 - 1) + 1) + 1);// use type casting
        // double r = (Math.random() * 11);
        System.out.println("random=" + r);
    }
}
import java.util.Random;
public class MyName {
    public static void main(String[] args) {
        int r = (int) (Math.random() * ((10 - 1) + 1) + 1);// use type casting
        // double r = (Math.random() * 11);
        System.out.println("random=" + r);
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("Max==" + Math.max(20, 30));
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("Max==" + Math.max(20.5, 30));
    }
}
public class MyName {
    public static void main(String[] args) {
        System.out.println("Max==" + Math.max(20.5, Math.max(30, 40)));
    }
}
import javax.swing.plaf.basic.BasicInternalFrameTitlePane.MaximizeAction;
public class MyName {
    public static void main(String[] args) {
        System.out.println("Pow=" + Math.pow((Math.sqrt(100)), 2));
    }
}










import java.util.Scanner;
/*write a Java method to find 
the smallest number among three numbers*/
public class MyName {
    static int min(int n1, int n2, int n3) {
        int minNumber = n1;
        if (minNumber > n2) {
            minNumber = n2;
        }
        if (minNumber > n3) {
            minNumber = n3;
        }
        return minNumber;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n1 = input.nextInt();
        int n2 = input.nextInt();
        int n3 = input.nextInt();
        System.out.println("minimum number=" + min(n1, n2, n3));
    }
}
import java.util.Scanner;
/*write a Java method to find 
the smallest number among three numbers*/
public class MyName {
    static int min(int n1, int n2, int n3) {
        int minNumber = n1;
        if (minNumber > n2) {
            minNumber = n2;
        }
        if (minNumber > n3) {
            minNumber = n3;
        }
        return minNumber;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter #1:");
        int n1 = input.nextInt();
        System.out.println("Enter #2:");
        int n2 = input.nextInt();
        System.out.println("Enter #3:");
        int n3 = input.nextInt();
        System.out.println("minimum number=" + min(n1, n2, n3));
    }
}
import java.util.Scanner;
/*
Write a Java method to compute the average of three numbers
 */
public class MyName {
    static float avg(float n1, float n2, float n3) {
        float average, sum = n1 + n2 + n3;
        average = sum / 3;
        return average;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("avg" + avg(100, 99, 98));
    }
}
import java.util.Scanner;
/*
Write a Java method to compute the average of three numbers
 */
public class MyName {
    static float avg(float n1, float n2, float n3) {
        return (n1 + n2 + n3) / 3;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("avg" + avg(100, 99, 98));
    }
}
import java.util.Scanner;
/*
Write a Java method to compute the average of three numbers
 */
public class MyName {
    static float avg(float n1, float n2, float n3) {
        return (n1 + n2 + n3) / 3;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        float ahmed = avg(10, 11, 12);
        ahmed++;
        System.out.println(ahmed);
    }
}
import java.util.Scanner;
public class MyName {
    public static int sum(int... n) {// int[]n
        int s = 0;
        for (int i : n) {
            s += i;
        }
        return s;
    }
    public static void main(String[] args) {
        System.out.println("sum =" + sum(5, 6, 7, 8));
    }
import java.util.Scanner;
public class MyName {
    public static int sum(int... n) {// int[]n
        int s = 0;
        for (int i : n) {//i=n every loop.
            s += i;
        }
        return s;
    }
    public static void main(String[] args) {
        System.out.println("sum =" + sum(5, 6, 7, 8));
    }
}
import java.util.Scanner;
public class MyName {
    public static int sum(int... n) {// int[]n
        int s = 0;
        for (int i : n) {//i=n every loop.
            s += i;//s=s+i;
        }
        return s;
    }
    public static void main(String[] args) {
        System.out.println("sum =" + sum(5, 6, 7, 8));
    }
}


public class MyName {
    public static void main(String[] args) {// Method/function.
        System.out.println("Ahmed");
        System.out.println("Ali");
        System.out.println("Mohammed");
        System.out.println("Belal");
    }
}
public class MyName {
    public static void main(String[] args) {// Method/function.
        System.out.println("Ahmed");
        System.out.println("Ali");
        System.out.println("Mohammed");
        System.out.println("Belal");
        System.out.println("Ahmed");
        System.out.println("Ali");
        System.out.println("Mohammed");
        System.out.println("Belal");
    }
}
public class MyName {
    // Return value type:void賳賵毓 丕賱賯賷賲丞 丕賱乇丕噩毓丞
    public static void fun() {
        System.out.println("Ahmed");
        System.out.println("Ali");
        System.out.println("Mohammed");
        System.out.println("Belal");
    }
    public static void main(String[] args) {// Method/function.
        // invoke,call丕爻鬲丿毓丕亍,丿毓賵賴
        fun();
    }
}
public class MyName {
    public static void fun() {
        System.out.println("Ahmed");
        System.out.println("Ali");
        System.out.println("Mohammed");
        System.out.println("Belal");
    }
    public static void main(String[] args) {
        fun();
        fun();
    }
}
public class MyName {
    public static void main(String[] args) {
        fun();
        fun();
    }
    public static void fun() {
        System.out.println("Ahmed");
        System.out.println("Ali");
        System.out.println("Mohammed");
        System.out.println("Belal");
    }
}
import java.util.Scanner;
public class MyName {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n1, n2;
        System.out.println("Enter number1:");
        n1 = input.nextInt();
        System.out.println("Enter number2:");
        n2 = input.nextInt();
        int sum = n1 + n2;
        System.out.println("the sum==" + sum);
    }
}
import java.util.Scanner;
public class MyName {
    static int SumTwoNumbers(int n1, int n2) {
        int sum = n1 + n2;
        return sum;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int n1, n2;
        System.out.println("Enter number1:");
        n1 = input.nextInt();
        System.out.println("Enter number2:");
        n2 = input.nextInt();
        System.out.println("the sum==" + SumTwoNumbers(n1, n2));
    }
}
import java.util.Scanner;
public class MyName {
    static int SumTwoNumbers(int n1, int n2) {
        int sum = n1 + n2;
        return sum;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("the sum==" + SumTwoNumbers(50, 60));
    }
}
import java.util.Scanner;
public class MyName {
    static int SumTwoNumbers(int n1, int n2) {
        return n1 + n2;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("the sum==" + SumTwoNumbers(50, 60));
        System.out.println("the sum==" + SumTwoNumbers(200, 50));
    }
}
import java.util.Scanner;
public class MyName {
    static int SumTwoNumbers(int n1, int n2) {
        return n1 + n2;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("the sum==" + SumTwoNumbers(50, 60));
        System.out.println("the sum==" + SumTwoNumbers(200, 50));
    }
}
import java.util.Scanner;
public class MyName {
    static int SumTwoNumbers(int n1, int n2) {
        System.out.println("sum:");
        return n1 + n2;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int s = SumTwoNumbers(5, 5);
        s = s + 2;
        System.out.println("sum==" + s);
    }
}
import java.util.Scanner;
public class MyName {
    static int SumTwoNumbers(int n1, int n2) {
        System.out.println("sum:");
        return n1 + n2;
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int s = SumTwoNumbers(5, 5);
        s = s + 2;
        System.out.println("sum==" + s);
    }
}
import java.util.Scanner;
public class MyName {
    static voidSumTwoNumbers(int n1, int n2) {
        System.out.println("sum=="+(n1+n2));
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int s = SumTwoNumbers(5, 5);//error
        s = s + 2;
        System.out.println("sum==" + s);
    }
}
import java.util.Scanner;
public class MyName {
    static void SumTwoNumbers(int n1, int n2) {
        System.out.println("sum==" + (n1 + n2));
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        SumTwoNumbers(5, 5);
    }
}
import java.util.Scanner;
public class MyName {
    static void SumTwoNumbers(int n1, int n2) {
        if (n1 == 0 && n2 == 0) {
            return;
        }
        System.out.println("sum==" + (n1 + n2));
    }
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        SumTwoNumbers(5, 5);
    }
}





     List<String> listOfReport = Stream.of(AlipayReports.values())
                .map(Enum::name)
                .collect(Collectors.toList());
import java.util.Scanner;

public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        test: {
            if (5 < 6) {
                break test;
            }
            System.out.println("1");
            System.out.println("2");
            System.out.println("3");
            System.out.println("4");
        }
        System.out.println("5");
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int row = 1; row <= 10; row++) {
            for (int column = 1; column <= 5; column++) {
                System.out.print("* ");
            }
            System.out.println("");
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        stop: {
            for (int row = 1; row <= 10; row++) {
                for (int column = 1; column <= 5; column++) {
                    if (row == 5) {
                        break stop;
                    }
                    System.out.print("* ");
                }
                System.out.println("");
            }
        }
    }
}
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int row = 1; row <= 5; row++) {
            System.out.println();
            for (int column = 1; column <= 10; column++) {
                if (column > row) {
                    continue;
                }
                System.out.print("* ");
            }
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        nextRow: for (int row = 1; row <= 5; row++) {
            System.out.println();
            for (int column = 1; column <= 10; column++) {
                if (column > row) {
                    continue nextRow;
                }
                System.out.print("* ");
            }

            System.out.println("Ahmed Abdelmoneim");
        }
    }
}
import java.util.Scanner;

public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 1; i <= 5; i++) {
            System.out.println("Outer loop#" + i);
            for (int j = 1; j <= 3; j++) {
                System.out.println("Nested loop#" + j);
            }
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 1; i <= 2; i++) {
            System.out.println("Outer loop#i=" + i);
            for (int j = 1; j <= 3; j++) {
                System.out.println("Nested loop#j=" + j);
                for (int k = 1; k <= 2; k++) {
                    System.out.println("Nested loop#k=" + k);
                }
            }
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0; i < 10; i++) {
            if (i == 4) {
                break;
            }
            System.out.println("i=" + i);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0; i < 10; i++) {
            if (i == 4) {
                break;
            }
            System.out.println("i=" + i);
        }
        System.out.println("Ahmed abdelmoneim");
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0; i < 10; i++) {
            if (i == 4) {
                continue;
            }
            System.out.println("i=" + i);
        }
        System.out.println("Ahmed abdelmoneim");
    }
}
import java.util.Scanner;

public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Test yourself:");
        System.out.println("what is '5+10/2*10=?':");
        float UserAnswer, TheCorrectAnswer = 55;
        boolean questionAnswer = false;
        for (int i = 1; i < 3; i++) {
            UserAnswer = input.nextFloat();
            if (UserAnswer == TheCorrectAnswer) {
                questionAnswer = true;
                break;
            } else if (UserAnswer != TheCorrectAnswer) {
                System.out.println("Chance #" + (i + 1) + " : ");
                continue;
            }
        }
        if (questionAnswer) {
            System.out.println("Correct Answer");
        } else {
            System.out.println("Wrong Answer");
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // Write a program to print numbers from 1 to 10.
        for (int i = 1; i < 10; i++) {
            System.out.println(i);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // Write a program to print numbers from 1 to 10.
        int i = 1;
        do {
            System.out.println(i);
            i++;
        } while (i <= 10);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        /*
         * Write a program to calculate the sum
         * of 10 floating point numbers using for loop.
         */
        float sum = 0;
        for (int i = 1; i <= 10; i++) {
            sum = sum + i;// sum+=i
        }
        System.out.println("sum==" + sum);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        /*
         * Write a program to calculate the sum of 10 floating point numbers using for loop.
         */
        float sum = 0;
        for (int i = 1; i <= 10; i++) {
            sum = sum + i;// sum+=i
        }
        System.out.println("sum==" + sum);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        /*
         * write a program to calculate the sum of 10 floating point number.
         */
        Scanner input = new Scanner(System.in);
        float sum = 0, num;
        for (float i = 1; i <= 10; i++) {
            System.out.println("Enter any number:");
            num = input.nextFloat();
            sum = sum + num;
        }
        System.out.println("sum==" + sum);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        /*
         * write a program that that asking the user to input a positive integer.It
         * should than print the multiplication table of that number.
         */
        Scanner input = new Scanner(System.in);
        int num = input.nextInt();
        for (int i = 1; i <= 10; i++) {
            System.out.println(num + "*" + i + "=" + (num * i));
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        /* write a program to find the factorial value of any number */
        // !4=4*3*2*1=24
        // !5=5*4*3*2*1=120
        Scanner input = new Scanner(System.in);
        System.out.println("Enter any number:");
        int num = input.nextInt();
        int f = 1;
        for (int i = num; i >= 1; i--) {
            f = f * i;
        }
        System.out.println("factorial==" + f);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        /*
         * Write a program that enters 10 integer number from the user,and then prints
         * the sum of the even and odd integers
         */
        Scanner input = new Scanner(System.in);
        int num, sumEven = 0, sumOdd = 0, i = 0;
        while (i < 10) {
            System.out.println("Enter integer number:");
            num = input.nextInt();
            if (num % 2 == 0) {
                sumEven = sumEven + num;
            } else {
                sumOdd = sumOdd + num;
            }
            i++;
        }
        System.out.println("The sum of Even numbers==" + sumEven);
        System.out.println("The sum of Odd numbers==" + sumOdd);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        /*
         * Write a program that enters 10 integer number from the user,and then prints
         * the sum of the even and odd integers
         */
        Scanner input = new Scanner(System.in);
        int num, sumEven = 0, sumOdd = 0, i = 0;
        int countEven = 0, countOdd = 0;
        while (i < 10) {
            System.out.println("Enter integer number:");
            num = input.nextInt();
            if (num % 2 == 0) {
                countEven++;
            } else {
                countOdd++;
            }
            i++;
        }
        System.out.println("The sum of Even numbers==" + countEven);
        System.out.println("The sum of Odd numbers==" + countOdd);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        // 1+ 1/2 + 1/3 + 1/4 + 1\5 +.......1/n
        Scanner input = new Scanner(System.in);
        int num = input.nextInt();
        float sum = 0;
        for (int i = 1; i <= num; i++) {
            sum += 1.0 / i;
        }
        System.out.println("sum is=" + sum);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        float n, sum = 0.0f;
        for (int i = 1; i <= 10; i++) {
            System.out.println("Enter # " + i + " : ");
            n = input.nextFloat();
            sum += n;
        }
        float avg = sum / 10;
        System.out.println("Avg==" + avg);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // Repetition control statament.
        // for loop.
        int c = 0;
        while (c < 5) {
            System.out.println(c);
            c++;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int c = 0;
        for (; c < 5;) {
            System.out.println(c);
            c++;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int c = 0; c < 5; c++) {
            System.out.println(c);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int c = 0; c < 5; c++) {
            System.out.println(c);
        }
        System.out.println("c==" + c);//error
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int c = 0;
        for (; c < 5; c++) {
            System.out.println(c);
        }
        System.out.println("c==" + c);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int c = 2; c < 10; c = c + 2) {//c+=2
            System.out.println(c);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int c = 2;
        for (; c < 10; c = c + 2) {
            System.out.println(c);
        }
        System.out.println(c);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 1; i < 10 && i % 2 == 0; ++i) {
            System.out.println(i);
            // i++;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0, j = 0; i < 10 && j < 10; ++i, ++j) {
            if (i % 2 == 0 && j % 2 == 0) {
                System.out.println(i + " " + j);
            }
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0, j = 0; i < 10 || j < 5; i++, j++) {
            System.out.println("i = " + i + "\t" + "j= " + j);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0, j = 0; i < 10 && j < 5; i++, j++) {
            System.out.println("i = " + i + "\t" + "j= " + j);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        for (int i = 0, j = 0; i < 10 && j < 5; i++, j++) {
            System.out.println("i = " + i + "\t" + "j= " + j);
        }
    }
}



import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // Repetition control statament.
        // for loop.
        int c = 0;
        while (c < 5) {
            System.out.println(c);
            c++;
        }
    }
}

import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int c = 0;
        do {
            System.out.println("java");
            c++;
        } while (c < 5);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int c = 0;
        do {
            System.out.println("java");
            c++;
        } while (false);
    }
}


import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // g f d 6 i k i o q
        char letter = 'a';
        while (letter != 'q') {
            letter = input.next().charAt(0);
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        // g f d 6 i k i o q
        int c = 0;
        char letter = 'a';
        while (letter != 'q') {
            letter = input.next().charAt(0);
            ++c;
        }
        System.out.println("Count=" + c);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        char letter = 'a';
        int c = 0;
        boolean flag = true;
        while (flag) {
            letter = input.next().charAt(0);
            c++;
            if (letter == 'q') {
                flag = false;
            }
        }
        System.out.println("Count:" + c);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        float sum = 0;
        float grade = 0;
        int count = 0;
        while (grade != -1) {
            System.out.println("Enter grade #" + (count + 1) + ": ");
            grade = input.nextFloat();
            if (grade != -1) {
                sum += grade;
                count++;
            }
        }
        System.out.println("Avg==" + sum / count);
    }
}

import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        while (true) {//just take (true) or (false)
            System.out.println("hello ahmed");
        }
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = 1;
        while (count <= 5) {
            System.out.println("HI");
            count++;
        }
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = 1;
        while (count <= 5) {
            System.out.println("HI");
            ++count;
        }
        System.out.println("count = " + count);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = 5;
        while (count >= 1) {
            System.out.println("HI");
            count--;
        }
        System.out.println("count = " + count);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = 5;
        while (count >= 1) {
            System.out.println("HI");
            count = count - 2;//count-=2
        }
        System.out.println("count = " + count);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = 1;
        while (count <= 5) {
            System.out.println("Hi");
            // ++count;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = 1;
        while (count++ <= 5) {
            System.out.println("Hi #" + count);
            // ++count;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int count = 1;
        while (count++ <= 5) {
            System.out.println("Hi #" + count);
            // ++count;
        }
        System.out.println("count=" + count);
    }
}



import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x = 2;
        switch (x) {
        case 1:
            System.out.println("case #1");
            break;
        case 2:
            System.out.println("case #2");
            break;
        case 3:
            System.out.println("case #3");
            break;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x = 5;
        switch (x) {
        case 1:
            System.out.println("case #1");
            break;
        case 2:
            System.out.println("case #2");
            break;
        case 3:
            System.out.println("case #3");
            break;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x = 5;
        switch (x) {
        case 1:
            System.out.println("case #1");
            // break;
        case 2:
            System.out.println("case #2");
            // break;
        case 3:
            System.out.println("case #3");
            // break;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x = 2;
        switch (x) {
        case 1:
            System.out.println("case #1");
            // break;
        case 2:
            System.out.println("case #2");
            // break;
        case 3:
            System.out.println("case #3");
            // break;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x = 1;
        switch (x) {
        case 1:
            System.out.println("case #1");
            // break;
        case 2:
            System.out.println("case #2");
            // break;
        case 3:
            System.out.println("case #3");
            // break;
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x = 1;
        switch (x) {
        case 1:
            System.out.println("case #1");
            // break;
        case 2:
            System.out.println("case #2");
            // break;
        case 3:
            System.out.println("case #3");
            // break;
        default:
            System.out.println("It is not an option");
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int x = 5;
        switch (x) {
        case 1:
            System.out.println("case #1");
            break;
        case 2:
            System.out.println("case #2");
            break;
        case 3:
            System.out.println("case #3");
            break;
        default:
            System.out.println("It is not an option");
        }
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Play enter day#");
        int day=input.nextInt();
        switch(day){
            case 1:
            case 2:
            case 3:
            case 4:
            case 5:
            System.out.println("Weekday");
            break;
            case 6:
            case 7:
            System.out.println("Weekday");
            break;
            default:
            System.out.println("It is not an option");
        }
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Play enter day#");
        int day = input.nextInt();
        switch (day) {// byte,short,char,and int primitive data types.
        case 1:
        case 2:
        case 3:
        case 4:
        case 5:
            System.out.println("Weekday");
            break;
        case 6:
        case 7:
            System.out.println("Weekday");
            break;
        default:
            System.out.println("It is not an option");
        }
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter one of these operators:(*, /, %, +, -)");
        char c = input.next().charAt(0);
        int n1, n2;
        System.out.println("Enter n1:");
        n1 = input.nextInt();
        System.out.println("Enter n2:");
        n2 = input.nextInt();
        switch (c) {
        case '*':
            System.out.println("res=" + (n1 * n2));
            break;
        case '/':
            System.out.println("res=" + (n1 / n2));
            break;
        case '%':
            System.out.println("res=" + (n1 % n2));
            break;
        case '+':
            System.out.println("res=" + (n1 + n2));
            break;
        case '-':
            System.out.println("res=" + (n1 - n2));
            break;
        default:
            System.out.println("It is not an option");
        }
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter a letter:");
        char c = input.next().charAt(0);
        switch (c) {
        case 'a':
            System.out.println(c);
            break;
        case 'b':
            System.out.println(c);
            break;
        case 'c':
            System.out.println(c);
            break;
        default:
            System.out.println("It is not an option");
        }
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        System.out.println("Enter a letter:");
        char c = input.next().charAt(0);
        switch (c) {
        case 'a':
            System.out.println(c);
            System.out.println("Enter number:");
            int x = input.nextInt();
            if (x < 10) {
                System.out.println("hello ahmed");
            }
            break;
        case 'b':
            System.out.println(c);
            break;
        case 'c':
            System.out.println(c);
            break;
        default:
            System.out.println("It is not an option");
        }
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        switch(3){//switch no can use (n>50&&n<100)
            case 1:{
                break;
            }
            case 2+1:
            System.out.println("case 2+1");
            break;
            default:
            System.out.println("It is not an option"));
        }          
    }
}
import java.util.Scanner;
import javax.swing.SwingConstants;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        switch(50){//switch no can use (n>50&&n<100)
            case 1:{
                break;
            }
            case 100:
            case 50:
            System.out.println("case 2+1");
            break;
            default:
            System.out.println("It is not an option");
        }       
    }
}

import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        int mark;
        Scanner input=new Scanner(System.in);
        System.out.println("Enter your grade:");
        mark=input.nextInt();
        if(mark>=90){
            System.out.println("A");
        }
        else if(mark>=80){
            System.out.println("B");
        }
        else if (mark>=70) {
            System.out.println("C");
        }
        else if(mark>=60){
            System.out.println("D");
        }
        else{
            System.out.println("fail");
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int mark;
        System.out.println("Please Enter mark:");
        mark = input.nextInt();
        if (mark >= 90 && mark <= 100) {
            System.out.println("A");
        } else if (mark >= 80 && mark < 90) {
            System.out.println("B");
        } else if (mark >= 70 && mark < 80) {
            System.out.println("C");
        } else if (mark >= 60 && mark < 70) {
            System.out.println("D");
        } else {
            System.out.println("fail");
        }
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        boolean x = (5 > 4) || (10 < 5 * 5);
        System.out.println(x);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int y = 1, z;
        if (y == 1) {
            z = 2;
        } else {
            z = 5;
        }
        System.out.println(z);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int y = 1;
        int Z = y == 1 ? 2 : 5;
        System.out.println(Z);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int y = 1;
        int Z = y == 2 ? 2 : 5;
        System.out.println(Z);
    }
}
import java.util.Scanner;
public class Mohamed {

    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int mark;
        mark = input.nextInt();
        String r = (mark >= 90 && mark <= 100) ? "A"
                : (mark >= 80 && mark < 90) ? "B"
                : (mark >= 70 && mark < 80) ? "C" 
                : (mark >= 60 && mark < 70) ? "D":"fail";
        System.out.println(r);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int mark;
        mark = input.nextInt();
        String r = (mark >= 90 && mark <= 100) ? "A"
                : (mark >= 80 && mark < 90) ? "B"
                : (mark >= 70 && mark < 80) ? "C" 
                : (mark >= 60 && mark < 70) ? "D" : "fail";
        System.out.println(r);
        System.out.println(r instanceof String);
    }
}
import java.util.Scanner;
public class Mohamed {
    public static void main(String[] args) {
        Scanner input = new Scanner(System.in);
        int mark;
        mark = input.nextInt();
        String r = (mark >= 90 && mark <= 100) ? "A"
                 : (mark >= 80 && mark < 90) ? "B"
                 : (mark >= 70 && mark < 80) ? "C" 
                 : (mark >= 60 && mark < 70) ? "D" : "fail";
        System.out.println(r);
        System.out.println(r instanceof String);// test data type
        System.out.println(input instanceof Scanner);//test data type
    }
}

public class Ahmedjava {
    public static void main(String[] args) {
        int num = 10;
        if (num > 0) {
            System.out.println("positive number.");
        }
    }
}
public class Ahmedjava {
    public static void main(String[] args) {
        int num = -10;
        if (num > 0) {
            System.out.println("positive number.");
        }
    }
}
public class Ahmedjava {
    public static void main(String[] args) {
        int num = 5;
        if (num == 5) {
            System.out.println("number=5");
        }
        System.out.println("Ahmed");
        System.out.println("medo");
    }
}
public class Ahmedjava {
    public static void main(String[] args) {
        int num = 5;
        if (num == 4) {
            System.out.println("number=5");
        }
        System.out.println("Ahmed");
        System.out.println("medo");
    }
}
import java.util.Scanner;

public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = 0;
        System.out.println("Enter integer number:");
        num = in.nextInt();
        if (num == 4) {
            System.out.println("number = 4");
        }
    }
}
import java.util.Scanner;

public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = 0;
        System.out.println("Enter integer number:");
        num = in.nextInt();
        if (num == 4) {
            System.out.println("number = 4");
            System.out.println("Thinks");
        }
        System.out.println("A");
        System.out.println("B");
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = 0;
        System.out.println("Enter integer number");
        num = in.nextInt();
        if (num > 0) {
            System.out.println("Positive!");
        } else {
            System.out.print("Negative!");
        }
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = 0;
        System.out.println("Enter integer number");
        num = in.nextInt();
        if(num%2==0){
            System.out.println("Even");
        }
        else{
            System.out.println("Odd");
        }
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = 0;
        System.out.println("Enter integer number");
        num = in.nextInt();
        if (num % 2 == 0) {
            if (num > 10) {
                System.out.println("Even");
            }
        } else {
            System.out.println("Odd");
        }
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = 0;
        System.out.println("Enter integer number");
        num = in.nextInt();
        if (num % 2 == 0) {
            if (num > 10) {
                System.out.println("Even");
                System.out.println("and greater than 10");
            } else {
                System.out.println("Even");
                System.out.println("and less than 10");
            }
        } else {
            System.out.println("Odd");
        }
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int num = 0;
        System.out.println("Enter integer number");
        num = in.nextInt();
        if(num>10){
        System.out.println("greater than 10");}
        else if(num==10){
        System.out.println("equal 10");}
        else {
        System.out.println("less than 10");}
    }
}


public class MyProgram {
	public static void main(String[] args) {
		int f=10;
		System.out.println(f);
	}
}
import java.util.Scanner;
public class MyProgram {
	public static void main(String[] args) {
		Scanner in= new Scanner(System.in);
		System.out.println("Enter number");
		int f=in.nextInt();
		System.out.println("number=="+f);
	}
}
import java.util.Scanner;
public class MyProgram {
	public static void main(String[] args) {
		Scanner in = new Scanner(System.in);
		float n1, n2;
		System.out.println("Please enter the first number:");
		n1 = in.nextFloat();
		System.out.println("Plase enter the second number:");
		n2 = in.nextFloat();
		System.out.println("num1="+n1+"\n"+"num2="+n2);
	}
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        float n1, n2;
        System.out.println("Please enter the first number:");
        n1 = in.nextFloat();
        System.out.println("Plase enter the second number:");
        n2 = in.nextFloat();
        System.out.println("num1=" + n1 + "\n" + "num2=" + n2);
        String out1 = String.format("num1=%f num2=%f", n1, n2);
        System.out.println(out1);
        // System.out.printf("num1=%.2f num2=%f",n1,n2);
    }
}
import java.util.Scanner;

public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter a value s:");
        String s = in.next();
        System.out.printf("s = %s", s);
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter a value s:");
        String s = in.nextLinea();
        System.out.printf("s = %S", s);
    }
}
import java.util.Scanner;

public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        System.out.println("Enter a value s:");
        char s = in.next().charAt(0);
        System.out.printf("s=%s", s);
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n1, n2;
        System.out.println("Enter num1:");
        n1 = in.nextInt();
        System.out.println("Enter num2:");
        n2 = in.nextInt();
        System.out.println("sum=" + (n1 + n2));//not n1+n2
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n1, n2, sum;
        System.out.println("Enter num1:");
        n1 = in.nextInt();
        System.out.println("Enter num2:");
        n2 = in.nextInt();
        sum = n1 + n2;
        System.out.println("sum=" + sum);
    }
}
import java.util.Scanner;
public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n1, n2, n3;
        System.out.println("Enter num1:");
        n1 = in.nextInt();
        System.out.println("Enter num2:");
        n2 = in.nextInt();
        System.out.println("Enter num3:");
        n3 = in.nextInt();
        System.out.println("Avg==" + (n1 + n2 + n3) / 3);

    }
}
import java.util.Scanner;

public class Ahmedjava {
    public static void main(String[] args) {
        Scanner in = new Scanner(System.in);
        int n1, n2, n3;
        System.out.println("Enter num1:");
        n1 = in.nextInt();
        System.out.println("Enter num2:");
        n2 = in.nextInt();
        System.out.println("Enter num3:");
        n3 = in.nextInt();
        System.out.println("Avg==" + (n1 + n2 + n3) / 3);

    }
}

public class MyProgram {
	public static void main(String[] args) {
		int x = 1;
		x++;//postfix/post(increment)
		System.out.println(x); 
		++x;//prefix/pre(increment)
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 1;
		System.out.println("x==" + ++x);//prefix
		int y = 1;
		System.out.println("y==" + y++);//postfix
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 1;
		System.out.println("x=" + x++ +"*"+ ++x +"*"+ x++);
		System.out.println("x=" + x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 1, y,z;
		y = x++;
		z=++x;      
		System.out.println("y="+y);
		System.out.println("x="+x);
		System.out.println("z="+z);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x=1,y;
		y=++x + x++;
		System.out.println("y=="+y);
		System.out.println("x=="+x);
	}
}

public class MyProgram {
	public static void main(String[] args) {
		int x = 1, y;
		y = (++x*2 + x++%2)/2;
		System.out.println("y==" + y);
		System.out.println("x==" + x);
	}
}
//the Assignment operators
public class MyProgram {
	public static void main(String[] args) {
		int k=5;
		k=k+10;//k+=10
		System.out.println("K=="+k);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		//Arithmetic Operators.
		//Relational Operators.
		//Bitwise,Logical,Assignment,Operators.
		//Miscellaneous Operators.
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x=10;
		System.out.println("x=="+x);
   }
}
public class MyProgram {
	public static void main(String[] args) {
		System.out.println(5+6*2);//17
        System.out.println(( 5 + 6 )*2);//22
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x=(5+6)*2;  
		System.out.println(x);
	}
}
//search operators precedence in java;
public class MyProgram {
	public static void main(String[] args) {
		int x = 5 * (2 * (2 + 1));
		//2+1=3
		//2*3=6
		//5*6
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 5 * 2 / 2;//left to right
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) { 
		System.out.println(2%5);
		System.out.println(5%5);
		System.out.println(6%5);
		System.out.println(7%5);
		System.out.println(8%5);
		System.out.println(9%5);
		System.out.println(10%5);
    }
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 2 % (5 + 5) * 3;
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		/*byte short =short
		int int = int 
		int float = float
		float double = double 
		int float short double =double*/
	}
}
public class MyProgram {
	public static void main(String[] args) {
		System.out.println(15/2);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		System.out.println(15.0/2);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		System.out.println(15.0f/2);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x=9,y=2;
		System.out.println(x/y);  
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 9, y = 2;
		System.out.println((float) x / y);//Type casting
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 9, y = 2;
		System.out.println((float) x / y);//Type casting
		//Widening primitive conversions
		//Narrowing primitive conversions
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 9, y = 2;
		System.out.println( x / y);//Type casting
		// Widening primitive conversions
		// Narrowing primitive conversions
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x = 9, y = 2;
		System.out.println((int) x /  y);//Type casting
		// Widening primitive conversions
		// Narrowing primitive conversions
	}
}

	




public class MyProgram {
	public static void main(String[] args) {
		 int x=1;
		  System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		byte x = -127;//127<_>-127
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		short x = 32767; // -32768<_>32767
		System.out.println(x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		short x = 10; 
		System.out.println("x="+x);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x;//can take 2147483647 value
		System.out.println(Integer.MAX_VALUE);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		int x;// can take -2147483648 value
		System.out.println(Integer.MIN_VALUE);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		float x = 2.5f;// can take 3.4028235E38 VALUE
		System.out.println(x);
		System.out.println(Float.MAX_VALUE);
		float y=2.1234567777f;
		System.out.println(y);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		double x = 2.123456789123456f;//1.79769331348623157E308;
		System.out.println(x);
		System.out.println(Double.MAX_VALUE);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		long x = 21474836488L;
		System.out.println(x);
		System.out.println(Long.MAX_VALUE);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		char x = 'A';// take just ' '
		System.out.println(x);
		System.out.println(Char.MAX_VALUE);//error cannot be resolved to variable
    }
}
public class MyProgram {
	public static void main(String[] args) {
		boolean x=false;
		System.out.println(x);
		boolean y=true;
		System.out.println(y);
	}
}
public class MyProgram {
	public static void main(String[] args) {
		String x = " Ahmed Abdelmoneim";
		System.out.println(x);
	}  
}
public class MyProgram {
	public static void main(String[] args) {
		byte BtoD = 0b1111111;
		System.out.println(BtoD);

	}

}


//Escape Sequences and Comments.
public class MyProgram {
    public static void main (String[] args) {
    	System.out.println("Ahmedmedo\"i love java and python\"");
    	System.out.println("Ahmedmedo\'i love java and python\'");
    	}
    	}
//Escape Sequences and Comments.
public class MyProgram {
    public static void main (String[] args) {
    	System.out.println("Ahmedmedo\"i love java and python\"");
    	System.out.println("Ahmedmedo\'i love java and python\'");
    	}
    	}
//Escape Sequences and Comments.
public class MyProgram {
    public static void main (String[] args) {
    	System.out.println("Ahmed\tmedo");//Tab
    	System.out.println("Ahmed\bmedo");//backspace
    	System.out.println("Ahmed\nmedo");//newline
    	System.out.println("Ahmed\rmedo");//carriage return.
    	System.out.println("Ahmed\fmedo");
    	System.out.println("Ahmed\'medo");
    	System.out.println("Ahmed\"medo");
    	System.out.println("Ahmed\\medo");
    	
    	
    	}
    	
    	}
<!DOCTYPE html>
<html lang="en">

<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/bootstrap.css">
    <title>Views Counts</title>
    <script src="https://unpkg.com/ionicons@5.4.0/dist/ionicons.js"></script>
</head>

<body>
    <br>
    <br>
    <h1 class="display-4 text-center text-white">Site Tracker</h1>
    <div class="container">
        <div class="card">
            <div class="container">
                <div class="card-header">
                    <h3>Visitor Views</h3>
                    <p>Last 30min</p>
                </div>
                <div class="card-body">
                    <h1 id="count">0</h1>
                </div>
            </div>
        </div>
        <div class="v-loc"></div>
    </div>

    <div class="loader-cont">
        <h3 class="text-white">Loading.......</h3>
        <div class="icon">
            <ion-icon name="cog-outline" class="ion"></ion-icon>
        </div>
    </div>

    <script src="view.js"></script>
    <script src="jquery.js"></script>
</body>

</html>
<?php 
use PHPMailer\PHPMailer\PHPMailer;
use PHPMailer\PHPMailer\Exception;

require_once "vendor/autoload.php";


if(isset($_POST['submit'])){
    $name = htmlspecialchars($_POST['name']);
    $email = htmlspecialchars($_POST['email']);
    $msg = htmlspecialchars($_POST['msg']);

    $error = "";
    $pass = "";
    // check if fields are empty

    if(empty($name) || empty($email) || empty($msg)){
        $error .= str_replace(" ", "-", "Fields cannot be empty");
        header("location: index.php?err=$error");
        die;
    }
    else if(!filter_var($email, FILTER_VALIDATE_EMAIL)){
        $error .= str_replace(" ", "-", "Email given is invalid");
        header("location: index.php?err=$error");
        die;
    }
    else {
        // if no error occur send mail
        $to = "alumonabenaiah71@gmail.com";
        $mail = new PHPMailer(true); 
        $mail->IsSMTP();
        $mail->Mailer = "smtp";
        $mail->SMTPDebug  = 1;  
        $mail->SMTPAuth   = TRUE;
        $mail->SMTPSecure = "tls";
        $mail->Port       = 587;
        $mail->Host       = "smtp.gmail.com";
        $mail->Username   = "your-gmail-account-address";
        $mail->Password   = "your-password";
        $mail->From = $email;
        $mail->FromName = $name;
        $mail->addAddress($to);
        $mail->Subject = "Contact Form Request";
        $mail->Body = $msg;
        if($mail->send()){
            $pass .= str_replace(" ", "-", "Message sent Successfully!!");
            header("location: index.php?pass=$pass");
            die;
        }else{
            $error .= str_replace(" ", "-", "An error occur while sending message, please try later ".$mail->ErrorInfo);
            header("location: index.php?err=$error");
            die;
        }
    }
}
else{
    header("location: index.php");
    die;
}

?>
body{
    width: 100%;
    height: 100vh;
    margin:0px;
    padding:0px;
    overflow-x: hidden;
    background:url("https://images.unsplash.com/photo-1530893609608-32a9af3aa95c?ixid=MXwxMjA3fDB8MHxzZWFyY2h8MTJ8fHRlY2h8ZW58MHx8MHw%3D&ixlib=rb-1.2.1&auto=format&fit=crop&w=500&q=60") !important;
    background-size:cover !important;
    background-repeat: no-repeat !important;
    background-position: center !important;
}
*{
    list-style: none;
    box-sizing: border-box;
}

.container{
    display:flex;
    align-items: center;
    justify-content: center;
    flex-direction: column;
    width:100%;
    height:100vh;
}
.container .form-cont{
    width:450px;
    padding:12px;
    background:rgba(0,0,0,.8);
    color:#fff;
}

.container .form-cont form textarea{
    height:100px;
}
<!DOCTYPE html>
<html lang="en">
<head>
    <meta charset="UTF-8">
    <meta http-equiv="X-UA-Compatible" content="IE=edge">
    <meta name="viewport" content="width=device-width, initial-scale=1.0">
    <title>Send Mail</title>
    <link rel="stylesheet" href="css/style.css">
    <link rel="stylesheet" href="css/bootstrap.css">
</head>
<body>
    <div class="container">
        <div class="form-cont">
            <h3>Contact Form</h3>
            <br>
            <div class="err-cont">
                <?php if(isset($_GET['err'])){?>
                <div class="alert alert-danger"><small><?php echo $_GET['err'];?></small></div>
                <?php }else if(isset($_GET['pass'])){?>
                <div class="alert alert-success"><small><?php echo $_GET['pass'];?></small></div>
                <?php }?>
            </div>
            <form action="sendmail.php" class="form-group" method="POST">
                <label for="fname">Fullname</label>
                <input type="text" name="name" placeholder="Your name.." class="form-control">
                
                <label for="fname">Email</label>
                <input type="email" name="email" placeholder="Your Email Address.." class="form-control">
                
                <label for="subject">Message</label>
                <textarea name="msg" placeholder="Write something.." class="form-control"></textarea>
            
                <input type="submit" name="submit" value="Send Message" class="btn btn-block btn-primary mt-2">
            
              </form>
        </div>
    </div>
</body>
</html>
/*
*  Unit 6 - Lesson 2 - Algorithms - Searching
*/
import java.io.*;
import static java.lang.System.*;

import java.util.Scanner;
import java.lang.Math;


class U6_L2_template{

  
     public static void main (String str[]) throws IOException {
          Scanner scan = new Scanner (System.in);
          
          double list [] =  {2.3 , 4.7 , 5.25 , 9.5 , 2.0 , 1.2 , 7.129 , 5.4 , 9.5 };
          
          System.out.println( "What are you looking for? ");
          double look = scan.nextDouble();
          
          //search for value in the array, print -1 if not found
          
          int where = -1;
          
          for (int i = 0; i < list.length; i++) {
            if (list[i] == look){
              where = i; 
              break;
            }
          }
          
          if (where == -1){
            System.out.println("Not Found");
          } else {
            System.out.println("Value at: " + where);
          }

     }

}



<android.support.v7.widget.CardView xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:card_view="http://schemas.android.com/apk/res-auto"
    android:id="@+id/card_view"
    android:layout_width="match_parent"
    android:layout_height="wrap_content"
    android:layout_gravity="center"
    android:focusable="true"
    android:clickable="true"
    card_view:cardCornerRadius="@dimen/card_corner_radius"
    card_view:cardUseCompatPadding="true">

    <LinearLayout
        android:id="@+id/card_item"
        android:layout_width="match_parent"
        android:layout_height="wrap_content"
        android:foreground="?android:attr/selectableItemBackground"
        android:padding="@dimen/card_padding">

    </LinearLayout>
</android.support.v7.widget.CardView>
private Page<ProgramReturnResponse> populatingleadLiaisonsInResponse(
			Page<ProgramReturnResponse> pageProgramReturnResponse) {
		List<ProgramReturnResponse> programResponseList = pageProgramReturnResponse.getContent();
		List<ProgramReturnResponse> updatedProgramResponseList = new ArrayList<>();
		List<Long> programIdList =                      
                 programResponseList.stream().map(ProgramReturnResponse::getProgramId)
				.collect(Collectors.toList());
		// programIdList = [101,102]
  
        List<ProgramMember> programMemberList = programMemberRepository
				.findLeadLaisonMembersByProgramId(programIdList,10);
        //programMemberList = [e0909, e22, e3030]
		MultiValueMap multiValueMap = new MultiValueMap();
  
		programMemberList.stream().forEach(programMember -> multiValueMap
				.put(programMember.getProgram().getProgramId(),                  
                     programMember.getMemberEmployeeId()));
  
         // multiValueMap = [ {101, [e0909, e22] } , {102, [e3030]}]
  
		for (ProgramReturnResponse programReturnResponse : programResponseList) {
			List<String> memberEids = (List<String>)       
                                       multiValueMap.get(programReturnResponse.getProgramId());
          
            // [e0909, e22]
            // [e3030]
			programReturnResponse.setLeadLiaisons(memberEids);
			updatedProgramResponseList.add(programReturnResponse);
		}
		return new PageImpl<>(updatedProgramResponseList, pageProgramReturnResponse.getPageable(),
				pageProgramReturnResponse.getTotalElements());
	}
import java.util.*;
import java.io.*;   

public class MyClass{
  public static void main(String[] args){
    
  }
}
public int[] topKFrequent(int[] nums, int k) {
        ArrayList<LinkedList<Integer>> freqList = new ArrayList<>();
        for (int i = 0; i <= nums.length; i++) {
            freqList.add(new LinkedList<Integer>());
        }
        
        HashMap<Integer, Integer> elementFreq = new HashMap<>();
        for (int i = 0; i < nums.length; i++) {
            if (elementFreq.containsKey(nums[i])){
                elementFreq.put(nums[i], elementFreq.get(nums[i]) + 1);
            }
            else {
                elementFreq.put(nums[i], 1);
            }
        }
        
        Iterator<Integer> elemItr = elementFreq.keySet().iterator();
        while (elemItr.hasNext()) {
            int currKey = elemItr.next();
            freqList.get(elementFreq.get(currKey)).add(currKey);
        }
        
        ArrayList<Integer> intsByFreq = new ArrayList<>();
        for (int i = 0; i < freqList.size(); i++) {            
            LinkedList<Integer> currList = freqList.get(i);
            ListIterator<Integer> currListItr = currList.listIterator(0);
            while (currListItr.hasNext()) {
                intsByFreq.add(currListItr.next());
            }
        }
        
        int[] topK = new int[k];
        int topKIdx = 0;
        for (int i = intsByFreq.size() - 1; i >= intsByFreq.size() - k; i--) {
            topK[topKIdx] = intsByFreq.get(i);
            topKIdx++;
        }
        
        return topK;
    }
public TreeNode mergeTrees(TreeNode t1, TreeNode t2) {
        if (t1 == null)
            return t2;
        Stack < TreeNode[] > stack = new Stack < > ();
        stack.push(new TreeNode[] {t1, t2});
        while (!stack.isEmpty()) {
            TreeNode[] t = stack.pop();
            if (t[0] == null || t[1] == null) {
                continue;
            }
            t[0].val += t[1].val;
            if (t[0].left == null) {
                t[0].left = t[1].left;
            } else {
                stack.push(new TreeNode[] {t[0].left, t[1].left});
            }
            if (t[0].right == null) {
                t[0].right = t[1].right;
            } else {
                stack.push(new TreeNode[] {t[0].right, t[1].right});
            }
        }
        return t1;
    }
public int climbStairs(int n) {
        int[] previousClimbs = new int[n + 1];
        previousClimbs[0] = 1;
        previousClimbs[1] = 1;
        for(int i = 2; i <= n; i++) {
            previousClimbs[i] = previousClimbs[i -1] + previousClimbs[i - 2];
        }
        
     return previousClimbs[n];
 }
import java.util.Random;

import javafx.animation.AnimationTimer;
import javafx.application.Application;
import javafx.scene.Scene;
import javafx.scene.canvas.Canvas;
import javafx.scene.canvas.GraphicsContext;
import javafx.scene.layout.BorderPane;
import javafx.scene.layout.Pane;
import javafx.stage.Stage;

public class Main extends Application {

    private static double SCENE_WIDTH = 800;
    private static double SCENE_HEIGHT = 600;

    static Random random = new Random();

    Canvas canvas;
    GraphicsContext graphicsContext;

    AnimationTimer loop;

    Scene scene;

    @Override
    public void start(Stage primaryStage) {

        BorderPane root = new BorderPane();

        canvas = new Canvas(SCENE_WIDTH, SCENE_HEIGHT);

        graphicsContext = canvas.getGraphicsContext2D();

        Pane layerPane = new Pane();

        layerPane.getChildren().addAll(canvas);

        root.setCenter(layerPane);

        scene = new Scene(root, SCENE_WIDTH, SCENE_HEIGHT);

        primaryStage.setScene(scene);
        primaryStage.show();

        startAnimation();

    }

    private void startAnimation() {

        loop = new AnimationTimer() {

            double startX = 100;
            double endX = 200;
            double y = 100;
            double x = startX;
            double speed = 0.2;

            @Override
            public void handle(long now) {

                graphicsContext.fillOval(x, y, 5,5);

                x+=speed;

                if( x >= endX) {
                    loop.stop();
                }
            }
        };

        loop.start();

    }

    public static void main(String[] args) {
        launch(args);
    }
}
public static String getHttpOnlyCookieHeader(Cookie cookie) {

    NewCookie newCookie = new NewCookie(cookie.getName(), cookie.getValue(), 
            cookie.getPath(), cookie.getDomain(), cookie.getVersion(), 
            cookie.getComment(), cookie.getMaxAge(), cookie.getSecure());

    return newCookie + "; HttpOnly";
}

And the usage:

response.setHeader("SET-COOKIE", getHttpOnlyCookieHeader(myOriginalCookie));


a bit late but since 2.0, javax.ws.rs.core.NewCookie has a constructor with httpOnly, you do not need to append it to toString() : NewCookie nc = new NewCookie("name","value","path","domain","comment",3600,true, true);
/*
Delay Message for 40 seconds
 */
import com.sap.gateway.ip.core.customdev.util.Message;
import java.util.HashMap;
def Message processData(Message message) {
    //Body 
       def body = message.getBody();
       sleep(40000);
       message.setBody(body);
       return message;
}
import java.util.Scanner;
			class Circle 
			{
			   double radius;
			   void setValues(double rad)
			   {
			      radius = rad;
			   }
			   void findArea()
			   {
			      double circleArea = Math.PI * radius * radius;
			      System.out.println("Area of circle = " + circleArea);
			   }
			   void findCircumference()
			   {
			      double circleCircumference = 2 * Math.PI * radius ;
			      System.out.println("Circumference of circle = " + circleCircumference);
			   }
			   
			}
			class Rectangle 
			{
			   double length,width;
			   void setValues(double len,double wid)
			   {
			      length = len;
			          width=wid;
			   }
			   void findArea()
			   {
			      double rectArea = length * width;
			      System.out.println("Area of Rectangle = " + rectArea);
			   }
			   
			}
			public class scratch_paper
			{
			public static void main(String[] args) 
			   {
			       double radius,length,width;
			       Scanner input= new Scanner(System.in);
			        
			         System.out.println("Type a radius:");
			         radius= input.nextDouble();
		                 System.out.println("Type a Length:");
			                 length = input.nextDouble();
			                 System.out.println("Type a width:");
			                 width = input.nextDouble();
			          System.out.println("circle with radius = " + radius);
			          Circle obj = new Circle();
			      obj.setValues(radius);
			      obj.findArea();
			      obj.findCircumference();
			          System.out.println("rectangle with length = " + length+",width"+width);
			          Rectangle obj1 = new Rectangle();
			      obj1.setValues(length,width);
			      obj1.findArea();
			      
			   }

}
import java.awt.Desktop;
import java.io.IOException;
import java.net.URI;
import java.net.URISyntaxException;

public class Browser {
    public static void main(String[] args) {
        String url = "http://www.google.com";

        if(Desktop.isDesktopSupported()){
            Desktop desktop = Desktop.getDesktop();
            try {
                desktop.browse(new URI(url));
            } catch (IOException | URISyntaxException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }else{
            Runtime runtime = Runtime.getRuntime();
            try {
                runtime.exec("xdg-open " + url);
            } catch (IOException e) {
                // TODO Auto-generated catch block
                e.printStackTrace();
            }
        }
    }
}
String myString = "1234";
int foo = Integer.parseInt(myString);
package com.edu4java.javatutorials;
import javax.swing.JOptionPane;

public class WhileCounterAcumulator {
	public static void main(String[] args) {
		int counter = 0;
		int accumulator = 0;
		while (counter < 5) {
			counter = counter + 1;
			accumulator = accumulator + Integer.parseInt(JOptionPane
				.showInputDialog("Enter the " + counter + "潞 number"));
		}
		JOptionPane.showMessageDialog(null, "The sum of the 5 numbers is " + accumulator);
	}
}
randomNum = minimum + (int)(Math.random() * maximum);
// Bug: `randomNum` can be bigger than `maximum`.
class TriangleDrawing{

    public static void main(String args[]){

        for(int x = 1; x <= 6; x++){

            for(int y = 1; y <= (6-x); y++){

                System.out.print(" ");

            }

            for(int z = 0; z < (x + (x-1)); z++){

                System.out.print("*");

            }

            for(int p = 1; p <= (6-x); p++){

                System.out.print(" ");

            }

            System.out.println();

        }

    }

}
 final JSONObject jsonBody = new JSONObject();


                        JSONObject RecieverInfo = new JSONObject();

                        RecieverInfo.put("FullName",recivername.getText().toString());
                        RecieverInfo.put("Phone2",reciverphoneksa.getText().toString());
                        RecieverInfo.put("Phone1",reciverphoneegy.getText().toString());

                        JSONObject Address1_R = new JSONObject();
                        Address1_R.put("CityId", recieverCities.get(spinner_Reciever_address_city.getSelectedItemPosition()));
                        Address1_R.put("AddressText", reciveraddressdetail.getText().toString());

                        RecieverInfo.put("Address1",Address1_R);
//                RecieverInfo.put("NationalID",mpreference.getReciverNationalId());

                        jsonBody.put("RecieverInfo",RecieverInfo);

                        JSONObject ClientInfo = new JSONObject();

                        ClientInfo.put("FullName",clientname.getText().toString());
                        ClientInfo.put("Phone2",clientphoneegy.getText().toString());
                        ClientInfo.put("Phone1",clientphoneksa.getText().toString());
                        if(clientemail.getText() != null )
                        ClientInfo.put("Email",clientemail.getText().toString());
                        else
                            ClientInfo.put("Email","");

                        JSONObject Address1_C = new JSONObject();
                        Address1_C.put("CityId", clientCities.get(spinner_client_address_city.getSelectedItemPosition()));
//                Address1_C.put("AddressText", mpreference.getClientAddressDetial());

                        ClientInfo.put("Address1",Address1_C);
                        ClientInfo.put("NationalID",clientnationalid.getText().toString());
//                ClientInfo.put("Nationality",mpreference.getClientNationality());

                        jsonBody.put("ClientInfo",ClientInfo);
import java.util.Collections;
import java.util.HashSet;
import java.util.Set;

/**
 * Java Program to demonstrate how to find duplicate words in String.
 */
public class DuplicateWordsInString{

    public static void main(String[] args) {
        String test = "This sentence contains two words, one and two";
        Set<String> duplicates = duplicateWords(test);
        System.out.println("input : " + test);
        System.out.println("output : " + duplicates);
    }


    /**
     * Method to find duplicate words in a Sentence or String
     * @param input String 
     * @return set of duplicate words
     */
    public static Set<String> duplicateWords(String input){
        
        if(input == null || input.isEmpty()){
            return Collections.emptySet();
        }
        Set<String> duplicates = new HashSet<>();
        
        String[] words = input.split("\\s+");
        Set<String> set = new HashSet<>();
        
        for(String word : words){
            if(!set.add(word)){
                duplicates.add(word);
            }
        }
        return duplicates;
    }
    
    
}

Output :
input : This sentence contains two words, one and two
output : [two]
String a = "Java";
String b = "Java";
System.out.println(a == b);  // True
// When you declare string like this, you are actually calling intern() method on String. 
// This method references internal pool of string objects.
// If there already exists a string value 鈥淛ava鈥, 
// then str will reference of that string and no new String object will be created


String c = new String("Java");
String d = new String("Java");
System.out.println(c == d);  // False
class MyTestClass {

    /* Load and parse YAML resource */
    @Rule
    public YamlResource<Person> spongeBob = givenResource()
            .yaml("/com/adelean/junit/jupiter/sponge-bob.yaml")
            .parseWith(new Yaml());

    /* Load and parse YAML documents resource */
    @Rule
    public YamlDocumentsResource<Log[]> logsAsArray = givenResource()
            .yamlDocuments("/com/adelean/junit/jupiter/logs.yml")
            .parseWith(new Yaml(new Constructor(Log.class)));
}
@TestWithResources
class TestsWithYaml {

    @WithSnakeYaml
    Yaml yaml = new Yaml();

    /* YAML resource with a single document */
    @GivenYamlResource("/com/adelean/junit/jupiter/receipt.yml")
    Map<String, Object> receipt;

    @GivenYamlResource("/com/adelean/junit/jupiter/sponge-bob.yaml")
    Person spongeBob;

    /* YAML resource with multiple documents separated by '---' */
    @GivenYamlDocumentsResource("/com/adelean/junit/jupiter/stacktrace.yaml")
    List<Map<String, Object>> stacktraceAsList;
}
class MyTestClass {

    /* Parse JSON with Jackson */
    @Rule
    public JsonResource<Map<String, Object>> jsonAsMap = givenResource()
            .json("/com/adelean/junit/jupiter/sponge-bob.json")
            .parseWith(new ObjectMapper());

    /* Parse JSON lines with Gson */
    @Rule
    public JsonLinesResource<Collection<Log>> logsAsCollection = givenResource()
            .jsonLines("/com/adelean/junit/jupiter/logs.jsonl")
            .parseWith(new Gson());
}
@TestWithResources
public class TestsWithJackson {

    @WithJacksonMapper
    ObjectMapper objectMapper = new ObjectMapper()
            .registerModule(new JavaTimeModule());

    /* JSON */
    @GivenJsonResource("/com/adelean/junit/jupiter/sponge-bob.json")
    Map<String, Object> jsonAsMap;

    @GivenJsonResource("/com/adelean/junit/jupiter/sponge-bob.json")
    JsonNode jsonNode;

    @GivenJsonResource("/com/adelean/junit/jupiter/sponge-bob.json")
    Person spongeBob;

    /* JSONL */
    @GivenJsonLinesResource("/com/adelean/junit/jupiter/logs.jsonl")
    Log[] logsAsArray;

    @GivenJsonLinesResource("/com/adelean/junit/jupiter/logs.jsonl")
    Collection<Log> logsAsCollection;
}
class MyTestClass {

    @Rule
    public PropertiesResource dbProperties = givenResource()
            .properties("/com/adelean/junit/jupiter/db.properties");

    @Test
    public void testWithJavaPropertiesResource() {
        assertThat(dbProperties.get())
                .containsEntry("db.user", "hosuaby")
                .containsEntry("db.password", "password")
                .containsEntry("db.url", "localhost");
    }
}
@TestWithResources
class InjectPropertiesResourcesTests {

    @GivenPropertiesResource("/com/adelean/junit/jupiter/db.properties")
    Properties dbProperties;

    @Test
    public void testInjectTextIntoStringInstanceField() {
        assertThat(dbProperties)
                .containsEntry("db.user", "hosuaby")
                .containsEntry("db.password", "password")
                .containsEntry("db.url", "localhost");
    }
}
class MyTestClass {

    @Rule
    public BinaryResource fibonacci = givenResource()
            .binary("/com/adelean/junit/jupiter/fibonacci.bin");

    @Test
    public void testWithBinaryResource() {
        assertThat(fibonacci.get())
                .contains(1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89);
    }
}
@TestWithResources
class InjectBinaryResourcesTests {

    @GivenBinaryResource("/com/adelean/junit/jupiter/fibonacci.bin")
    byte[] fibonacci;

    @Test
    public void testInjectBinaryContentIntoByteArrayInstanceField() {
        assertThat(fibonacci)
                .contains(1, 1, 2, 3, 5, 8, 13, 21, 34, 55, 89);
    }
}
import static com.adelean.inject.resources.junit.vintage.GivenResource.givenResource;

class MyTestClass {

    @Rule
    public ResourceRule<String> textResource = givenResource()
            .text("/com/adelean/junit/jupiter/resource.txt")
            .withCharset(StandardCharsets.UTF_8);

    @Test
    public void testWithTextResource() {
        assertThat(textResource.get())
                .isEqualTo("The quick brown fox jumps over the lazy dog.");
    }
}
@TestWithResources  // <-- add extension
public class InjectTextResourcesTests {

    @GivenTextResource("/com/adelean/junit/jupiter/resource.txt")
    String resourceContent;   // <-- inject resource content

    @Test
    public void testInjectTextIntoStringInstanceField() {
        assertThat(resourceContent)
                .isEqualTo("The quick brown fox jumps over the lazy dog.");
    }
}
URL url = Resources.getResource("com/adelean/junit/jupiter/resource.txt");
try {
    String resourceContent = Resources.toString(url, StandardCharsets.UTF_8);
} catch (IOException ioException) {
    // handle exception
}
String resourcePath = "com/adelean/junit/jupiter/resource.txt";
ClassLoader classLoader = getClass().getClassLoader();
              
StringBuilder textBuilder = new StringBuilder();
              
try (InputStream resourceAsStream = classLoader.getResourceAsStream(resourcePath);
     InputStreamReader streamReader = new InputStreamReader(resourceAsStream);
     BufferedReader bufferedReader = new BufferedReader(streamReader)) {
    int c = 0;
    while ((c = bufferedReader.read()) != -1) {
        textBuilder.append((char) c);
    }
} catch (IOException ioException) {
    // handle exception
}
              
String resourceContent = textBuilder.toString();
public static int kadanesAlgorithm(int[] array) {
   
int maxEndingHere = array[0];
int maxSoFar = array[0];
		
for(int i=1; i<array.length; i++){
			
maxEndingHere = Math.max(maxEndingHere+ array[i], array[i]);
maxSoFar = Math.max(maxSoFar, maxEndingHere);
			
}
return maxSoFar;
}
public static List<Integer> moveElementToEnd(List<Integer> array, int toMove) {	
  int i = 0;
  int j = array.size()-1;
		
  while(i < j){
			
	while( i < j && array.get(j) == toMove)
		j--;
	if(array.get(i) == toMove)
	   swap(i,j, array);
		
    i++;							
  }		
	return array;		
  }
	
public static void swap(int i, int j, List<Integer> array ){
			
  int temp = array.get(i);
  array.set(i, array.get(j));			
  array.set(j, temp);
}
	/**
	 * This method returns true if the collection is null or is empty.
	 * 
	 * @param collection
	 * @return true | false
	 */
	public static boolean isEmpty(Collection<?> collection) {
		if (collection == null || collection.isEmpty()) {
			return true;
		}
		return false;
	}
聽
	/**
	 * This method returns true of the map is null or is empty.
	 * 
	 * @param map
	 * @return true | false
	 */
	public static boolean isEmpty(Map<?, ?> map) {
		if (map == null || map.isEmpty()) {
			return true;
		}
		return false;
	}
聽
	/**
	 * This method returns true if the object is null.
	 * 
	 * @param object
	 * @return true | false
	 */
	public static boolean isEmpty(Object object) {
		if (object == null) {
			return true;
		}
		return false;
	}
聽
	/**
	 * This method returns true if the input array is null or its length is zero.
	 * 
	 * @param array
	 * @return true | false
	 */
	public static boolean isEmpty(Object[] array) {
		if (array == null || array.length == 0) {
			return true;
		}
		return false;
	}
聽
	/**
	 * This method returns true if the input string is null or its length is zero.
	 * 
	 * @param string
	 * @return true | false
	 */
	public static boolean isEmpty(String string) {
		if (string == null || string.trim().length() == 0) {
			return true;
		}
		return false;
	}
$test = collect([
   [
     'key1' => ['value1' => 5, 'value2' => 3, 'value3' => 0],
     'key2' => ['value1' => 1, 'value2' => 6, 'value3' => 2],
     'key3' => ['value1' => 0, 'value2' => 0, 'value3' => 1],
   ],

   [
     'key1' => ['value1' => 3, 'value2' => 1, 'value3' => 7],
     'key2' => ['value1' => 1, 'value2' => 3, 'value3' => 2],
     'key3' => ['value1' => 1, 'value2' => 6, 'value3' => 1],
   ],

   [
     'key1' => ['value1' => 2, 'value2' => 3, 'value3' => 9],
     'key2' => ['value1' => 3, 'value2' => 8, 'value3' => 3],
     'key3' => ['value1' => 1, 'value2' => 0, 'value3' => 6],
   ]
]);
$mappedCollection = collect($test->first())->keys()->mapWithKeys(function($item,$key) use($test){
   return[
      $item => $test->map(function ($mapItem, $mapKey) use($item) {         
         return $mapItem[$item];
      })
   ];
})->mapWithKeys(function($item,$key){
   $eachLine = collect($item->first())->keys()->mapWithKeys(function($mapItem) use($item){
      return[ $mapItem => $item->sum($mapItem)  ];
   });       
   return [$key =>  $eachLine];
})->all();

dd($mappedCollection);
public class ArrayStoreException
extends RuntimeException
final Duration timeout = Duration.ofSeconds(30);
ExecutorService executor = Executors.newSingleThreadExecutor();

final Future<String> handler = executor.submit(new Callable() {
    @Override
    public String call() throws Exception {
        return requestDataFromModem();
    }
});

try {
    handler.get(timeout.toMillis(), TimeUnit.MILLISECONDS);
} catch (TimeoutException e) {
    handler.cancel(true);
}

executor.shutdownNow();
List<String> songList = new ArrayList<>();
songList.add("Some song"); //Repeat until satisfied

System.out.println("\n\tWelcome! Please choose a song!");
String songChoice = scan.nextLine();
while (!songList.contains(songChoice)) {
    //Do stuff when input is not a recognised song
}
String fileFullPath = "Your\\java\\ file \\full\\path";
    JavaDocBuilder builder = new JavaDocBuilder();
    builder.addSource(new FileReader( fileFullPath  ));

    JavaSource src = builder.getSources()[0];
    String[] imports = src.getImports();

    for ( String imp : imports )
    {
        System.out.println(imp);
    }
itemList.stream()
          .filter(item -> item.getPropertyList()
                         .stream().anyMatch(property -> property.getKey().equals("Test")))
           .collect(Collectors.toList());
private boolean oneQueenPerRow() {
    int foundQueens;
    for (int i = 0; i < board.length; i++) {
        foundQueens = 0;//each loop is a checked row
        for (int j = 0; j < board.length; j++) {
            if (board[i][j] == QUEEN)
                foundQueens++;
        }
        if (foundQueens > 1) return false;
    }
    return true;
}
enum State {
  Visited,
  Unvisited,
  Visiting    
}
class Node {
    State state;
    public Node() {
        // say something about the state
    }
}
import javax.swing.*;  
public class FirstSwingExample {  
public static void main(String[] args) {  
JFrame f=new JFrame();//creating instance of JFrame  
          
JButton b=new JButton("click");//creating instance of JButton  
b.setBounds(130,100,100, 40);//x axis, y axis, width, height  
          
f.add(b);//adding button in JFrame  
          
f.setSize(400,500);//400 width and 500 height  
f.setLayout(null);//using no layout managers  
f.setVisible(true);//making the frame visible  
}  
}  
import java.util.Stack;

/**
 * Java Program to implement a binary search tree. A binary search tree is a
 * sorted binary tree, where value of a node is greater than or equal to its
 * left the child and less than or equal to its right child.
 * 
 * @author WINDOWS 8
 *
 */
public class BST {

    private static class Node {
        private int data;
        private Node left, right;

        public Node(int value) {
            data = value;
            left = right = null;
        }
    }

    private Node root;

    public BST() {
        root = null;
    }

    public Node getRoot() {
        return root;
    }

    /**
     * Java function to check if binary tree is empty or not
     * Time Complexity of this solution is constant O(1) for
     * best, average and worst case. 
     * 
     * @return true if binary search tree is empty
     */
    public boolean isEmpty() {
        return null == root;
    }

    
    /**
     * Java function to return number of nodes in this binary search tree.
     * Time complexity of this method is O(n)
     * @return size of this binary search tree
     */
    public int size() {
        Node current = root;
        int size = 0;
        Stack<Node> stack = new Stack<Node>();
        while (!stack.isEmpty() || current != null) {
            if (current != null) {
                stack.push(current);
                current = current.left;
            } else {
                size++;
                current = stack.pop();
                current = current.right;
            }
        }
        return size;
    }


    /**
     * Java function to clear the binary search tree.
     * Time complexity of this method is O(1)
     */
    public void clear() {
        root = null;
    }

}
import java.util.ArrayDeque;
import java.util.Arrays;
import java.util.Queue;

class Pair {
    int x, y;

    public Pair(int x, int y) {
        this.x = x;
        this.y = y;
    }
}

class FloodFill
{
    // Below arrays details all 8 possible movements
    private static final int[] row = { -1, -1, -1, 0, 0, 1, 1, 1 };
    private static final int[] col = { -1, 0, 1, -1, 1, -1, 0, 1 };

    // check if it is possible to go to pixel (x, y) from
    // current pixel. The function returns false if the pixel
    // has different color or it is not a valid pixel
    public static boolean isSafe(char[][] M, int m, int n,
                                int x, int y, char target)
    {
        return x >= 0 && x < m && y >= 0 && y < n
                && M[x][y] == target;
    }

    // Flood fill using BFS
    public static void floodfill(char[][] M, int x, int y, char replacement)
    {
        int m = M.length;
        int n = M[0].length;

        // create a queue and enqueue starting pixel
        Queue<Pair> q = new ArrayDeque<>();
        q.add(new Pair(x, y));

        // get target color
        char target = M[x][y];

        // run till queue is not empty
        while (!q.isEmpty())
        {
            // pop front node from queue and process it
            Pair node = q.poll();

            // (x, y) represents current pixel
            x = node.x;
            y = node.y;

            // replace current pixel color with that of replacement
            M[x][y] = replacement;

            // process all 8 adjacent pixels of current pixel and
            // enqueue each valid pixel
            for (int k = 0; k < row.length; k++)
            {
                // if adjacent pixel at position (x + row[k], y + col[k]) is
                // a valid pixel and have same color as that of current pixel
                if (isSafe(M, m, n, x + row[k], y + col[k], target))
                {
                    // enqueue adjacent pixel
                    q.add(new Pair(x + row[k], y + col[k]));
                }
            }
        }
    }

    public static void main(String[] args)
    {
        // matrix showing portion of the screen having different colors
        char[][] M = {
            "YYYGGGGGGG".toCharArray(),
            "YYYYYYGXXX".toCharArray(),
            "GGGGGGGXXX".toCharArray(),
            "WWWWWGGGGX".toCharArray(),
            "WRRRRRGXXX".toCharArray(),
            "WWWRRGGXXX".toCharArray(),
            "WBWRRRRRRX".toCharArray(),
            "WBBBBRRXXX".toCharArray(),
            "WBBXBBBBXX".toCharArray(),
            "WBBXXXXXXX".toCharArray()
        };

        // start node
        int x = 3, y = 9;   // target color = "X"

        // replacement color
        char replacement = 'C';

        // replace target color with replacement color
        floodfill(M, x, y, replacement);

        // print the colors after replacement
        for (int i = 0; i < M.length; i++) {
            System.out.println(Arrays.toString(M[i]));
        }
    }
}
import org.json.*;


JSONObject obj = new JSONObject(" .... ");
String pageName = obj.getJSONObject("pageInfo").getString("pageName");

JSONArray arr = obj.getJSONArray("posts");
for (int i = 0; i < arr.length(); i++)
{
    String post_id = arr.getJSONObject(i).getString("post_id");
    ......
}
allprojects {
    repositories {
      google()
      jcenter()
    }
  }
> More steps
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <ImageView
        android:id="@+id/app_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:focusable="false"
        android:clickable="false"
        android:contentDescription="@string/app_name"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="16dp"
        android:paddingBottom="8dp"/>

    <TextView
        android:id="@+id/list_app_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textStyle="bold"
        android:textIsSelectable="false"
        android:textSize="16dp"
        android:textColor="#000000"
        android:layout_toEndOf="@+id/app_icon"
        android:layout_alignTop="@+id/app_icon"
        android:layout_marginStart="16dp"
        android:layout_marginTop="2dp"
        android:text="@string/app_name"/>
    <CheckBox
        android:id="@+id/list_app_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_marginEnd="12dp"
        android:checked="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:clickable="false"
        android:layout_alignTop="@id/list_app_name"

        />

</RelativeLayout>

> More steps
double[] doubleArray = { 7.0, 9.0, 5.0, 1.0, 3.0 };
System.out.println(Arrays.toString(doubleArray));
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout xmlns:android="http://schemas.android.com/apk/res/android"
    xmlns:app="http://schemas.android.com/apk/res-auto"
    xmlns:tools="http://schemas.android.com/tools"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    android:background="@drawable/backgroundgradient"
    tools:context=".ui.Signup">

    <ImageView
            android:layout_width="130dp"
            android:layout_height="100dp"
            android:layout_centerInParent="true"
            android:src="@drawable/logosp" />

</RelativeLayout>
> More steps
nt[] intArray = { 7, 9, 5, 1, 3 };
System.out.println(Arrays.toString(intArray));
<?xml version="1.0" encoding="utf-8"?>
<RelativeLayout
    xmlns:android="http://schemas.android.com/apk/res/android"
    android:layout_width="match_parent"
    android:layout_height="match_parent"
    >
    <ImageView
        android:id="@+id/app_icon"
        android:layout_width="48dp"
        android:layout_height="48dp"
        android:focusable="false"
        android:clickable="false"
        android:contentDescription="@string/app_name"
        android:layout_alignParentLeft="true"
        android:layout_alignParentTop="true"
        android:layout_marginLeft="16dp"
        android:layout_marginTop="16dp"
        android:paddingBottom="8dp"/>

    <TextView
        android:id="@+id/list_app_name"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:textStyle="bold"
        android:textIsSelectable="false"
        android:textSize="16dp"
        android:textColor="#000000"
        android:layout_toEndOf="@+id/app_icon"
        android:layout_alignTop="@+id/app_icon"
        android:layout_marginStart="16dp"
        android:layout_marginTop="2dp"
        android:text="@string/app_name"/>
    <CheckBox
        android:id="@+id/list_app_checkbox"
        android:layout_width="wrap_content"
        android:layout_height="wrap_content"
        android:layout_alignParentEnd="true"
        android:layout_marginEnd="12dp"
        android:checked="false"
        android:focusable="false"
        android:focusableInTouchMode="false"
        android:clickable="false"
        android:layout_alignTop="@id/list_app_name"

        />

</RelativeLayout>

> More steps
int[] myIntArray = new int[3];
int[] myIntArray = {1, 2, 3};
int[] myIntArray = new int[]{1, 2, 3};
> More steps
public class User {

    public String mUsername;

    public User(){
        // Default constructor required for calls to DataSnapshot.getValue(User.class)
    }

    public User( String userName){
        this.mUsername = userName;
    }
}
> More steps
String myString = "1234";
int foo = Integer.parseInt(myString);
    private ArrayList<String> arrayList;
    ListAdapter listAdapter;

   String[] array = new String[5];
                array[0] = "optn 1";
                array[1] = "optn 2";
                array[2] = "optn 3";
// in on create method

        arrayList = new ArrayList<>();
        listAdapter = new ArrayAdapter<>(this, android.R.layout.simple_list_item_1 , array);
        mAvailableProfilesList.setAdapter(listAdapter);
        
> More steps
StringWriter writer = new StringWriter();
IOUtils.copy(inputStream, writer, encoding);
String theString = writer.toString();
import java.util.concurrent.ThreadLocalRandom;

// nextInt is normally exclusive of the top value,
// so add 1 to make it inclusive
int randomNum = ThreadLocalRandom.current().nextInt(min, max + 1);
Arrays.asList(yourArray).contains(yourValue)
String[] array = new String[] {"John", "Mary", "Bob"};
System.out.println(Arrays.toString(array));
<?xml version="1.0" encoding="utf-8"?>
<shape xmlns:android="http://schemas.android.com/apk/res/android">
    <gradient
        android:angle="45"
        android:startColor="#ff00ff"
        android:endColor="#000000"/>
</shape>
> More steps
for(int i = 0; i < 108; i++) {
System.out.println('Jai Shri Ram!');
}
// IntendedActivity - the file you wish to open
// CurrentActivity - the file where this code is placed  

Intent intent = new Intent (this, IntendedActivity.class);
    CurrentActivity.this.startActivity(intent);
 public void sort(int array[]) { 
     for (int i = 1; i < array.length; i++) { 
          int key = array[i]; 
          int j = i - 1; 
          while (j >= 0 && array[j] > key) { 
              array[j + 1] = array[j]; 
              j = j - 1; 
          } 
          array[j + 1] = key; 
      } 
 }
> More steps
public class LocalDatabase extends SQLiteOpenHelper {
         
    private static final String mDatabaseName = "LocalDatabase";
    private static final int mDatabaseVersion = 1;

public LocalDatabase(Context context) {
        super(context, mDatabaseName, null, mDatabaseVersion);
        SQLiteDatabase db = this.getWritableDatabase();
    }      

}
> More steps
class Main
{
	static int totalWeight = 0;
    // A class to represent a graph edge
    class Edge implements Comparable<Edge>
    {
        int src, dest, weight;
 
        // Comparator function used for sorting edges based on
        // their weight
        public int compareTo(Edge compareEdge)
        {
            return this.weight-compareEdge.weight;
        }
    };
 
    // A class to represent a subset for union-find
    class subset
    {
        int parent, rank;
    };
 
    int V, E;	// V-> no. of vertices & E->no.of edges
    Edge edge[]; // collection of all edges
 
    // Creates a graph with V vertices and E edges
    Main(int v, int e)
    {
        V = v;
        E = e;
        edge = new Edge[E];
        for (int i=0; i<e; ++i)
            edge[i] = new Edge();
    }
 
    // A utility function to find set of an element i
    // (uses path compression technique)
    int find(subset subsets[], int i)
    {
        // find root and make root as parent of i (path compression)
        if (subsets[i].parent != i)
            subsets[i].parent = find(subsets, subsets[i].parent);
 
        return subsets[i].parent;
    }
 
    // A function that does union of two sets of x and y
    // (uses union by rank)
    void Union(subset subsets[], int x, int y)
    {
        int xroot = find(subsets, x);
        int yroot = find(subsets, y);
 
        // Attach smaller rank tree under root of high rank tree
        // (Union by Rank)
        if (subsets[xroot].rank < subsets[yroot].rank)
            subsets[xroot].parent = yroot;
        else if (subsets[xroot].rank > subsets[yroot].rank)
            subsets[yroot].parent = xroot;
 
        // If ranks are same, then make one as root and increment
        // its rank by one
        else
        {
            subsets[yroot].parent = xroot;
            subsets[xroot].rank++;
        }
    }
 
    // The main function to construct MST using Kruskal's algorithm
    void KruskalMST()
    {
        Edge result[] = new Edge[V];  // Tnis will store the resultant MST
        int e = 0;  // An index variable, used for result[]
        int i = 0;  // An index variable, used for sorted edges
        for (i=0; i<V; ++i)
            result[i] = new Edge();
 
        // Step 1:  Sort all the edges in non-decreasing order of their
        // weight.  If we are not allowed to change the given graph, we
        // can create a copy of array of edges
        Arrays.sort(edge);
 
        // Allocate memory for creating V ssubsets
        subset subsets[] = new subset[V];
        for(i=0; i<V; ++i)
            subsets[i]=new subset();
 
        // Create V subsets with single elements
        for (int v = 0; v < V; ++v)
        {
            subsets[v].parent = v;
            subsets[v].rank = 0;
        }
 
        i = 0;  // Index used to pick next edge
 
        // Number of edges to be taken is equal to V-1
        while (e < V - 1)
        {
            // Step 2: Pick the smallest edge. And increment the index
            // for next iteration
            Edge next_edge = new Edge();
            next_edge = edge[i++];
 
            int x = find(subsets, next_edge.src);
            int y = find(subsets, next_edge.dest);
 
            // If including this edge does't cause cycle, include it
            // in result and increment the index of result for next edge
            if (x != y)
            {
                result[e++] = next_edge;
                Union(subsets, x, y);
            }
            // Else discard the next_edge
        }
        int totalMSTWeight = 0;
        


        
        for (i = 0; i < e; ++i) {
        		totalMSTWeight += result[i].weight;
        }
//        System.out.println("total " + totalWeight);
//        System.out.println("MST " + totalMSTWeight);
        System.out.println(totalWeight - totalMSTWeight);
    }
 
    // Driver Program
    public static void main (String[] args) throws Exception
    {
    		BufferedReader br = new BufferedReader (new InputStreamReader(System.in));
    		String in = br.readLine();
    		
    		while (!in.equals("0 0")) {
    			totalWeight = 0;
    			String [] split = in.split(" ");
        		int V = Integer.parseInt(split[0]);
        		int E = Integer.parseInt(split[1]);

            Main graph = new Main(V, E);
            
            for (int i=0; i<E; i++) {
            		in = br.readLine();
            		//System.out.println("split2: " + in);
            		String [] split2 = in.split(" ");
            		int a = Integer.parseInt(split2[0]);
            		int b = Integer.parseInt(split2[1]);
            		int c = Integer.parseInt(split2[2]);
            		
            		graph.edge[i].src = a;
            		graph.edge[i].dest = b;
            		graph.edge[i].weight = c;
            		
            		totalWeight += c;
            		//System.out.println("source: "+a+", dest: " + b + " weight: "+ c);
            }
            graph.KruskalMST();
            in = br.readLine();
    		}
    }
}
String[][] deepArray = new String[][] {{"John", "Mary"}, {"Alice", "Bob"}};
System.out.println(Arrays.toString(deepArray));
//output: [[Ljava.lang.String;@106d69c, [Ljava.lang.String;@52e922]
System.out.println(Arrays.deepToString(deepArray));
Map<String, String> map = ...
for (Map.Entry<String, String> entry : map.entrySet()) {
    System.out.println(entry.getKey() + "/" + entry.getValue());
}
star

Sun Jan 16 2022 06:50:27 GMT+0000 (UTC)

#java
star

Sun Jan 16 2022 06:21:23 GMT+0000 (UTC)

#java
star

Sun Jan 16 2022 06:11:04 GMT+0000 (UTC)

#java
star

Sun Jan 16 2022 05:58:03 GMT+0000 (UTC)

#java
star

Sun Jan 16 2022 05:57:04 GMT+0000 (UTC)

#java
star

Sun Jan 16 2022 05:56:14 GMT+0000 (UTC)

#java
star

Tue Jan 04 2022 16:36:22 GMT+0000 (UTC)

#java
star

Tue Jan 04 2022 06:41:48 GMT+0000 (UTC)

#c #java
star

Wed Dec 22 2021 11:51:09 GMT+0000 (UTC)

#java #enum
star

Mon Dec 20 2021 12:45:44 GMT+0000 (UTC)

#java #enum
star

Fri Dec 17 2021 08:12:32 GMT+0000 (UTC) https://www.ben-willenbring.com/willenblog/adding-tooltips-on-squarespace-with-popperjs

#tooltip #info #header #java
star

Fri Dec 17 2021 08:12:01 GMT+0000 (UTC) https://www.ben-willenbring.com/willenblog/adding-tooltips-on-squarespace-with-popperjs

#tooltip #info #header #java
star

Fri Dec 10 2021 05:05:00 GMT+0000 (UTC) https://leetcode.com/problems/minimum-deletions-to-make-character-frequencies-unique/

#java
star

Fri Dec 10 2021 00:44:11 GMT+0000 (UTC)

#java
star

Fri Dec 10 2021 00:42:02 GMT+0000 (UTC)

#java
star

Thu Dec 09 2021 23:54:00 GMT+0000 (UTC)

#java
star

Fri Dec 03 2021 10:47:18 GMT+0000 (UTC) https://refactoring.guru/design-patterns/singleton/java/example

#java #design_patterns
star

Fri Dec 03 2021 10:41:43 GMT+0000 (UTC)

#java
star

Thu Dec 02 2021 11:46:38 GMT+0000 (UTC) https://www.youtube.com/watch?v=pNiRNRgi5Ws&ab_channel=DanVega

#java
star

Thu Nov 18 2021 08:40:38 GMT+0000 (UTC)

#java
star

Wed Nov 17 2021 19:49:36 GMT+0000 (UTC)

#java
star

Wed Nov 17 2021 07:53:08 GMT+0000 (UTC) https://sgo.tomedu.ru/angular/school/studentdiary/

#java #c++
star

Sun Nov 07 2021 17:09:29 GMT+0000 (UTC) https://howtodoinjava.com/java/io/java-read-file-to-string-examples/

#java #r/w #file
star

Fri Oct 29 2021 19:57:58 GMT+0000 (UTC) https://stackoverflow.com/questions/6055476/how-to-convert-object-to-string-in-java

#java
star

Wed Oct 27 2021 18:16:11 GMT+0000 (UTC) https://stackoverflow.com/questions/41201019/gson-json-string-to-list-of-pojo

#java
star

Thu Oct 21 2021 05:12:26 GMT+0000 (UTC) https://devconnected.com/how-to-undo-last-git-commit/

#java #git
star

Wed Oct 20 2021 07:33:45 GMT+0000 (UTC)

#java
star

Fri Oct 15 2021 09:20:54 GMT+0000 (UTC)

#java #test #easyrandom
star

Fri Oct 15 2021 09:19:22 GMT+0000 (UTC)

#java #test #easyrandom
star

Sat Sep 25 2021 20:13:50 GMT+0000 (UTC)

#java
star

Sat Sep 25 2021 20:11:37 GMT+0000 (UTC)

#java
star

Thu Sep 23 2021 01:07:56 GMT+0000 (UTC) http://profesores.fi-b.unam.mx/carlos/java/java_basico2_5.html

#java
star

Thu Sep 23 2021 01:07:05 GMT+0000 (UTC) https://aprendeaprogramar.com/cursos/verApartado.php?id

#java
star

Thu Sep 23 2021 01:04:36 GMT+0000 (UTC) https://aprendeaprogramar.com/cursos/verApartado.php?id

#java
star

Thu Sep 23 2021 01:02:39 GMT+0000 (UTC) https://aprendeaprogramar.com/cursos/verApartado.php?id

#java
star

Thu Sep 23 2021 01:01:38 GMT+0000 (UTC) https://aprendeaprogramar.com/cursos/verApartado.php?id

#java
star

Thu Sep 23 2021 01:00:20 GMT+0000 (UTC) https://www.geeksforgeeks.org/string-in-switch-case-in-java/

#java
star

Thu Sep 23 2021 00:58:29 GMT+0000 (UTC) http://dis.um.es/~lopezquesada/documentos/IES_1213/IAW/curso/UT3/ActividadesAlumnos/5/index.html

#java
star

Thu Sep 23 2021 00:55:34 GMT+0000 (UTC) https://www.javatpoint.com/post/java-scanner-next-method

#java
star

Fri Sep 17 2021 02:37:12 GMT+0000 (UTC)

#java
star

Fri Sep 10 2021 17:53:44 GMT+0000 (UTC)

#java
star

Thu Sep 09 2021 06:34:28 GMT+0000 (UTC)

#java
star

Thu Sep 09 2021 06:33:14 GMT+0000 (UTC)

#java
star

Thu Sep 09 2021 06:27:33 GMT+0000 (UTC)

#java
star

Wed Sep 08 2021 01:29:44 GMT+0000 (UTC)

#java
star

Mon Sep 06 2021 18:04:41 GMT+0000 (UTC)

#java
star

Wed Sep 01 2021 19:30:09 GMT+0000 (UTC) https://www.w3schools.com/java/java_inheritance.asp

#java
star

Tue Aug 03 2021 10:14:19 GMT+0000 (UTC)

#commandline #java
star

Mon Jul 26 2021 06:08:27 GMT+0000 (UTC)

#java
star

Mon Jul 26 2021 06:04:59 GMT+0000 (UTC) undefined

#java
star

Tue Jul 20 2021 11:39:22 GMT+0000 (UTC)

#java
star

Sat Jul 10 2021 11:50:59 GMT+0000 (UTC)

#java
star

Wed Jun 30 2021 16:09:17 GMT+0000 (UTC) https://stackoverflow.com/questions/1200621/how-do-i-declare-and-initialize-an-array-in-java

#java
star

Sat Jun 26 2021 22:09:34 GMT+0000 (UTC)

#java
star

Sat Jun 26 2021 22:09:34 GMT+0000 (UTC)

#java
star

Mon Jun 14 2021 07:21:03 GMT+0000 (UTC)

#quartz #java
star

Sat Jun 05 2021 08:38:05 GMT+0000 (UTC)

#java
star

Thu May 27 2021 06:42:44 GMT+0000 (UTC)

#java
star

Sat May 22 2021 08:56:37 GMT+0000 (UTC)

#java
star

Fri May 21 2021 12:57:01 GMT+0000 (UTC) https://www.guru99.com/apex-tutorial.html

#java
star

Wed May 19 2021 23:03:47 GMT+0000 (UTC) https://www.thephani.com/how-to-get-help-text-message-into-apex/

#java
star

Wed May 19 2021 23:03:40 GMT+0000 (UTC) https://www.thephani.com/how-to-get-help-text-message-into-apex/

#java
star

Wed May 19 2021 23:03:33 GMT+0000 (UTC) https://www.thephani.com/how-to-get-help-text-message-into-apex/

#java
star

Wed May 19 2021 23:03:22 GMT+0000 (UTC) https://www.thephani.com/how-to-get-help-text-message-into-apex/

#java
star

Wed May 19 2021 23:03:16 GMT+0000 (UTC) https://www.thephani.com/how-to-get-help-text-message-into-apex/

#java
star

Mon May 17 2021 11:52:05 GMT+0000 (UTC) https://stackoverflow.com/questions/2626835/is-there-functionality-to-generate-a-random-character-in-java

#java
star

Wed May 12 2021 01:03:34 GMT+0000 (UTC) https://blog.csdn.net/iku5200/article/details/102571424

#java
star

Tue May 11 2021 05:07:22 GMT+0000 (UTC) https://stackoverflow.com/questions/435890/find-java-classes-implementing-an-interface

#java
star

Tue May 11 2021 05:06:03 GMT+0000 (UTC) https://stackoverflow.com/questions/9991253/finding-all-classes-implementing-a-specific-interface

#java
star

Mon May 10 2021 23:03:22 GMT+0000 (UTC) https://trailhead.salesforce.com/content/learn/modules/developer_console/developer_console_queries

#java
star

Mon May 10 2021 23:02:54 GMT+0000 (UTC) https://trailhead.salesforce.com/content/learn/modules/developer_console/developer_console_queries

#java
star

Mon May 03 2021 20:21:59 GMT+0000 (UTC) https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components/create-a-hello-world-lightning-web-component

#java
star

Mon May 03 2021 20:21:02 GMT+0000 (UTC) https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components/create-a-hello-world-lightning-web-component

#java
star

Mon May 03 2021 20:20:15 GMT+0000 (UTC) https://trailhead.salesforce.com/content/learn/projects/quick-start-lightning-web-components/create-a-hello-world-lightning-web-component

#java
star

Sat May 01 2021 23:45:12 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 06:25:59 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 03:47:30 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 02:56:56 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 02:26:49 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 02:24:14 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 01:24:35 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 00:59:12 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 00:51:21 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 00:31:01 GMT+0000 (UTC)

#java
star

Tue Apr 27 2021 00:26:04 GMT+0000 (UTC)

#java
star

Mon Apr 26 2021 23:51:09 GMT+0000 (UTC)

#java
star

Sun Apr 25 2021 22:45:37 GMT+0000 (UTC)

#java
star

Sun Apr 25 2021 22:34:05 GMT+0000 (UTC)

#java
star

Sun Apr 25 2021 22:30:05 GMT+0000 (UTC)

#java
star

Sun Apr 25 2021 22:07:49 GMT+0000 (UTC)

#java
star

Fri Apr 23 2021 19:38:52 GMT+0000 (UTC)

#java
star

Fri Apr 23 2021 18:49:48 GMT+0000 (UTC)

#java
star

Fri Apr 23 2021 10:26:45 GMT+0000 (UTC)

#java
star

Fri Apr 23 2021 07:43:15 GMT+0000 (UTC)

#java
star

Fri Apr 23 2021 07:26:58 GMT+0000 (UTC)

#java
star

Thu Apr 22 2021 13:21:21 GMT+0000 (UTC)

#java
star

Thu Apr 22 2021 10:05:18 GMT+0000 (UTC)

#java
star

Thu Apr 22 2021 08:09:33 GMT+0000 (UTC)

#java
star

Thu Apr 22 2021 08:03:08 GMT+0000 (UTC)

#java
star

Thu Apr 22 2021 07:42:42 GMT+0000 (UTC)

#java
star

Wed Apr 21 2021 23:00:35 GMT+0000 (UTC)

#java
star

Wed Apr 21 2021 04:10:18 GMT+0000 (UTC)

#java
star

Wed Apr 21 2021 00:58:28 GMT+0000 (UTC)

#java
star

Tue Apr 20 2021 20:43:07 GMT+0000 (UTC)

#java
star

Tue Apr 20 2021 04:27:58 GMT+0000 (UTC)

#java
star

Tue Apr 20 2021 02:04:33 GMT+0000 (UTC)

#java
star

Tue Apr 20 2021 01:29:37 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 23:07:00 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 21:20:17 GMT+0000 (UTC)

#java