0% found this document useful (0 votes)
5 views3 pages

Libraries (Scanner Array)

The document provides an overview of the Scanner class in Java for input handling, including various input methods and validation checks. It also covers basic operations and important methods related to arrays, including sorting, copying, and searching. Additionally, it highlights commonly used methods for quick reference in coding and exams.

Uploaded by

abdulmoiz.mi11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
5 views3 pages

Libraries (Scanner Array)

The document provides an overview of the Scanner class in Java for input handling, including various input methods and validation checks. It also covers basic operations and important methods related to arrays, including sorting, copying, and searching. Additionally, it highlights commonly used methods for quick reference in coding and exams.

Uploaded by

abdulmoiz.mi11
Copyright
© All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd

🔷 1. Scanner Class ([Link].

Scanner)
🔹 Creating Scanner
Scanner sc = new Scanner([Link]);

🔹 Input Methods
[Link](); // int
[Link](); // double
[Link](); // float
[Link](); // long
[Link](); // short
[Link](); // byte
[Link](); // boolean
[Link](); // one word
[Link](); // full line
[Link]().charAt(0); // char

🔹 Checking Methods (Validation)


 [Link]();
 [Link]();
 [Link]();
 [Link]();
 [Link]();
 [Link]();
 [Link]();
 [Link]();
 [Link]();

🔹 Other Useful Methods


[Link](","); // change input separator
[Link]("pattern"); // skip input
[Link](); // reset scanner
[Link](); // close scanner
[Link](); // check error

🔷 2. Arrays (Basic Operations)


[Link]; // size of array
arr[i]; // access element

🔷 3. Arrays Class ([Link])


🔹 Import
import [Link];

🔹 All Important Methods


[Link](arr); // sort
[Link](arr); // fast sort

[Link](arr); // convert to string


[Link](arr); // for 2D arrays

[Link](arr1, arr2); // compare arrays


[Link](arr1, arr2); // compare 2D

[Link](arr, value); // fill array

[Link](arr, newLength); // copy array


[Link](arr, start, end); // copy range

[Link](arr, key); // search (sorted)

[Link](arr); // hash code


[Link](arr); // for 2D

[Link](arr); // array → list


[Link](arr, i -> i * 2); // set values
[Link](arr, (x,y)->x+y);// cumulative sum

🔷 4. One-Line Quick Revision


Scanner:

👉 Input → nextInt(), nextLine()


👉 Check → hasNextInt()
👉 Other → close(), useDelimiter()

Arrays:
👉 Sort → [Link]()
👉 Print → [Link]()
👉 Copy → copyOf()
👉 Search → binarySearch()

🔷 5. Important Tip (Exam + Coding)


👉 Most used in real coding:

 nextInt()
 nextLine()
 [Link]()
 [Link]()
 [Link]()

You might also like