Snippets Collections
+	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();  
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} {
	
	/******************************************************************************
	 * Local variables
	 ******************************************************************************/
	private static ${Class Name} instance;


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

	
	/******************************************************************************
	 * Local methods
	 ******************************************************************************/
	public static ${Class Name} getInstance() {
		if (instance == null) {
			instance = new ${Class Name}();
		}
		return instance;
	}
	
		
	/******************************************************************************
	 * Getter and Setter
	 ******************************************************************************/


}
	
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 “Java”, 
// 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

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 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

Sun Aug 15 2021 02:20:52 GMT+0000 (UTC) https://www.quizcure.com/java/what-is-constructor-in-java-with-example-program

#java
star

Sun Aug 15 2021 02:19:04 GMT+0000 (UTC) https://www.quizcure.com/java/what-is-a-copy-constructor-in-java-program

#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
star

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

#java
star

Mon Apr 19 2021 18:22:50 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 08:04:07 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 06:18:57 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 05:31:32 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 05:01:45 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 03:16:29 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 02:31:02 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 02:21:10 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 02:15:07 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 01:24:47 GMT+0000 (UTC)

#java
star

Mon Apr 19 2021 00:53:04 GMT+0000 (UTC)

#java
star

Sun Apr 18 2021 05:56:55 GMT+0000 (UTC)

#java
star

Sat Apr 17 2021 21:58:12 GMT+0000 (UTC)

#java
star

Sat Apr 17 2021 17:48:38 GMT+0000 (UTC)

#java
star

Sat Apr 17 2021 02:13:09 GMT+0000 (UTC)

#java
star

Fri Apr 16 2021 22:04:18 GMT+0000 (UTC)

#java
star

Fri Apr 16 2021 22:04:12 GMT+0000 (UTC)

#java
star

Fri Apr 16 2021 21:59:42 GMT+0000 (UTC)

#java
star

Sun Apr 04 2021 03:01:38 GMT+0000 (UTC)

#android #java
star

Sun Apr 04 2021 03:01:06 GMT+0000 (UTC) https://www.semicolonworld.com/question/48686/ripple-effect-on-android-lollipop-cardview

#android #java
star

Sun Mar 28 2021 04:39:16 GMT+0000 (UTC) https://www.thewarehouse.pk/

#java
star

Mon Mar 01 2021 10:25:04 GMT+0000 (UTC)

#java
star

Wed Feb 24 2021 22:35:52 GMT+0000 (UTC)

#java
star

Sat Feb 20 2021 21:52:03 GMT+0000 (UTC)

#java
star

Sat Feb 20 2021 21:47:55 GMT+0000 (UTC)

#java
star

Thu Feb 11 2021 11:07:11 GMT+0000 (UTC) https://stackoverflow.com/questions/34720911/how-to-create-filling-animation-in-javafxpixel-by-pixel-canvas

#java
star

Fri Jan 29 2021 16:39:09 GMT+0000 (UTC) https://stackoverflow.com/questions/13147113/setting-an-httponly-cookie-with-javax-servlet-2-5

#java #httponly #coockie #jax-rs
star

Tue Dec 22 2020 12:56:40 GMT+0000 (UTC) https://blogs.sap.com/2020/12/16/do-you-want-to-make-your-iflow-sleep-or-pause-or-delay-for-sometime/

#java
star

Thu Dec 03 2020 22:24:07 GMT+0000 (UTC)

#java
star

Thu Dec 03 2020 16:50:47 GMT+0000 (UTC) https://stackoverflow.com/questions/5226212/how-to-open-the-default-webbrowser-using-java

#java
star

Tue Dec 01 2020 12:53:06 GMT+0000 (UTC) https://www.google.com/search?rlz

#java
star

Mon Nov 30 2020 13:06:36 GMT+0000 (UTC) http://www.edu4java.com/en/java/while-statement-counter-accumulator-variable.html

#java
star

Thu Nov 19 2020 12:04:58 GMT+0000 (UTC) https://stackoverflow.com/questions/309424/how-do-i-read-convert-an-inputstream-into-a-string-in-java

#inputstream #string #java
star

Mon Nov 09 2020 15:45:43 GMT+0000 (UTC) https://stackoverflow.com/questions/363681/how-do-i-generate-random-integers-within-a-specific-range-in-java?rq

#java
star

Mon Nov 09 2020 14:56:12 GMT+0000 (UTC) https://stackoverflow.com/questions/29486087/drawing-shapes-using-java-for-loops

#java
star

Sat Oct 24 2020 09:04:52 GMT+0000 (UTC)

#java
star

Sun Oct 18 2020 05:53:02 GMT+0000 (UTC) https://javarevisited.blogspot.com/2015/07/how-to-find-duplicate-words-in-string-java.html

#java
star

Mon Sep 07 2020 03:49:21 GMT+0000 (UTC) https://www.java67.com/2014/08/difference-between-string-literal-and-new-String-object-Java.html

#java
star

Thu Aug 27 2020 11:25:11 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:24:25 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:23:14 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:21:36 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:19:39 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:18:55 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:17:58 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:16:41 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:14:33 GMT+0000 (UTC)

#java
star

Thu Aug 27 2020 11:11:22 GMT+0000 (UTC)

#java
star

Fri Aug 14 2020 12:03:53 GMT+0000 (UTC)

#java
star

Fri Aug 14 2020 12:00:13 GMT+0000 (UTC)

#java
star

Sun Jul 12 2020 21:32:42 GMT+0000 (UTC)

#java
star

Sun Jul 12 2020 21:30:28 GMT+0000 (UTC)

#java
star

Mon Jun 22 2020 13:33:03 GMT+0000 (UTC) https://stackoverflow.com/questions/48888406/merge-two-laravel-collections-and-sum-the-values

#java
star

Sat May 16 2020 19:48:57 GMT+0000 (UTC) https://docs.oracle.com/javase/8/docs/api/java/lang/ArrayStoreException.html

#java
star

Sat May 16 2020 19:40:35 GMT+0000 (UTC) https://stackoverflow.com/questions/19456313/simple-timeout-in-java

#java
star

Wed Apr 01 2020 11:31:57 GMT+0000 (UTC) https://stackoverflow.com/questions/60967832/insert-arraylist-into-while-condition

#java #java #arraylists #while-loops #equala
star

Wed Apr 01 2020 10:09:44 GMT+0000 (UTC) https://stackoverflow.com/questions/5701305/how-to-get-all-imports-defined-in-a-class-using-java-reflection

#java #java #reflection #dependencies
star

Wed Apr 01 2020 08:28:49 GMT+0000 (UTC) https://stackoverflow.com/questions/60966469/how-to-find-an-element-in-array-of-object-with-streams

#java #java #stream #array
star

Wed Apr 01 2020 08:24:35 GMT+0000 (UTC) https://stackoverflow.com/questions/60963813/how-do-you-check-a-row-in-a-2d-char-array-for-a-specific-element-and-then-count

#java #java #2dchar array
star

Wed Apr 01 2020 07:05:44 GMT+0000 (UTC) https://stackoverflow.com/questions/60963806/how-can-i-implement-a-class-when-one-of-its-properties-is-an-enum-variable

#java #java #enumvariable #class
star

Wed Jan 01 2020 19:00:00 GMT+0000 (UTC) https://www.javatpoint.com/java-swing

#java #howto #interviewquestions #mobile
star

Sun Dec 29 2019 20:06:50 GMT+0000 (UTC) https://javarevisited.blogspot.com/2015/10/how-to-implement-binary-search-tree-in-java-example.html#axzz4wnEtnNB3

#java #interviewquestions #search
star

Thu Dec 26 2019 19:01:13 GMT+0000 (UTC) https://www.techiedelight.com/flood-fill-algorithm/

#java #logic #algorithms #interesting #arrays
star

Thu Dec 26 2019 16:01:30 GMT+0000 (UTC) https://stackoverflow.com/questions/2591098/how-to-parse-json-in-java

#java #howto #json
star

https://stackoverflow.com/questions/409784/whats-the-simplest-way-to-print-a-java-array

#java
star

https://stackoverflow.com/questions/409784/whats-the-simplest-way-to-print-a-java-array

#java
star

https://stackoverflow.com/questions/1200621/how-do-i-declare-and-initialize-an-array-in-java

#java
star

https://stackoverflow.com/questions/5585779/how-do-i-convert-a-string-to-an-int-in-java

#java
star

https://stackoverflow.com/questions/309424/how-do-i-read-convert-an-inputstream-into-a-string-in-java

#java
star

https://stackoverflow.com/questions/363681/how-do-i-generate-random-integers-within-a-specific-range-in-java

#java
star

https://stackoverflow.com/questions/1128723/how-do-i-determine-whether-an-array-contains-a-particular-value-in-java

#java
star

https://stackoverflow.com/questions/409784/whats-the-simplest-way-to-print-a-java-array

#java
star

https://stackoverflow.com/questions/409784/whats-the-simplest-way-to-print-a-java-array

#java
star

https://stackoverflow.com/questions/46898/how-do-i-efficiently-iterate-over-each-entry-in-a-java-map

#java

Save snippets that work with our extensions

Available in the Chrome Web Store Get Firefox Add-on Get VS Code extension