Java Basic

Java is a high-level, class-based, object-oriented programming language that is designed to have as few implementation dependencies as possible. It is a versatile and powerful programming language that has been widely adopted for building a variety of applications, ranging from mobile apps to large-scale enterprise systems. Java was initially developed by Sun Microsystems (which has since been acquired by Oracle Corporation) and released in 1995.

Key Features of Java:

  1. Platform Independence:
    • One of the most significant features of Java is its platform independence. Java programs are compiled into bytecode, which can be executed on any system that has a Java Virtual Machine (JVM). This “write once, run anywhere” capability makes Java highly portable and suitable for cross-platform development.
  2. Object-Oriented:
    • Java is a pure object-oriented language, meaning everything is treated as an object. It supports key object-oriented programming concepts such as inheritance, encapsulation, polymorphism, and abstraction, which help in building modular, reusable, and maintainable code.
  3. Robust and Secure:
    • Java provides strong memory management, automatic garbage collection, and exception handling, making it a robust language. Additionally, Java has built-in security features, such as bytecode verification and a security manager, which help in developing secure applications.
  4. Multithreading:
    • Java supports multithreading, allowing concurrent execution of two or more threads. This feature is essential for developing applications that perform multiple tasks simultaneously, such as web servers and graphical user interfaces.
  5. Rich Standard Library:
    • Java comes with a comprehensive standard library (Java API) that provides a wide range of classes and methods for various tasks, such as data structures, networking, file I/O, database connectivity, and graphical user interface development.
  6. High Performance:
    • Although Java is an interpreted language, modern JVM implementations use Just-In-Time (JIT) compilation to improve performance. JIT compilers convert bytecode into native machine code at runtime, resulting in faster execution.
  7. Scalability:
    • Java is highly scalable and can be used to build small applications as well as large, complex enterprise systems. Its scalability makes it a popular choice for developing web applications, enterprise software, and large-scale distributed systems.
  8. Community and Ecosystem:
    • Java has a large and active community, which contributes to a rich ecosystem of frameworks, tools, and libraries. Popular frameworks such as Spring, Hibernate, and Apache Struts, as well as tools like Maven and Gradle, enhance Java development productivity.

Java Home

1
Java Home
5 minutes

Java, a widely-used programming language.

Java Introduction

1
Java Introduction
5 minutes

Java, a renowned programming language originating in 1995, is under the ownership of Oracle.

Java Get Started

1
Java Get Started
5 minutes

"Java Get Started": Dive into the fundamentals of Java programming, laying the groundwork for your coding exploration.

Java Syntax

1
Java Syntax
10 mintues

Java syntax refers to the set of rules governing the structure and composition of Java code, including its keywords, punctuation, and conventions for writing statements and expressions.

Java Output / Print

1
Print Text
5 mintues

Printing text refers to displaying textual information, such as words, sentences, or characters, typically on a screen or on paper.

2
Print Numbers
5 minutes

Print Numbers refers to a command or function in programming that outputs a sequence of numerical values to a display or console.

Java Comments

1
Java Comments
10 minutes

Java comments are annotations within the code that are ignored by the compiler. They serve to enhance code readability and provide explanatory notes to developers.

Java Variables

1
Variables
10 minutes

Variables are named storage locations in programming that can hold and manipulate data values.

2
Print Variables
5 minutes

Print Variables refers to the act of outputting the values of variables to a display or console in a program.

3
Multiple Variables
5 minutes

Multiple Variables refers to the use of more than one variable in a program to store and manage different data values simultaneously.

4
Java Identifiers
5 minutes

Java identifiers are names used to identify variables, methods, classes, packages, and interfaces in Java code.

5
Real-Life Examples
10 minutes

Real-life examples illustrate practical applications of concepts or principles in everyday situations.

Java Data Types

1
Data Types
10 minutes

Data types are classifications that specify the type of data a variable can hold and the operations that can be performed on it.

2
Numbers
10 mintues

Java Numbers refer to the various data types in Java used to represent numeric values, including integers, floating-point numbers, and characters.

3
Boolean
5 mintues

Java Boolean Data Types represent values that are either true or false, used for logical operations and conditional statements.

4
Characters
5 minutes

Java characters represent single letters, digits, or special symbols enclosed within single quotes.

5
Real-Life Example
10 minutes

A real-life example of a String in Java is a person's name stored in a variable, such as "John Smith".

6
Non-Primitive Data Types
5 minutes

Non-primitive data types in Java are complex data structures that do not directly hold their data but rather reference memory locations where the data is stored.

Java Type Casting

1
Java Type Casting
5 minutes

Java type casting involves converting a variable of one data type into another data type. This can be either implicit or explicit and helps ensure compatibility between different data types during operations or assignments.

Java Operators

1
Java Operators
10 minutes

Java operators are symbols that perform operations on variables and values, such as arithmetic, logical, and relational operations.

Java Strings

1
Strings
10 minutes

Strings in Java are sequences of characters enclosed within double quotes. They are non-primitive data types that represent textual data and are extensively used for storing and manipulating textual information in Java programs.

2
Concatenation
5 minutes

Java String Concatenation refers to the process of combining or joining multiple strings into a single string. This can be achieved using the '+' operator or the concat() method in Java.

3
Numbers and Strings
5 minutes

Numbers and strings are fundamental data types used for arithmetic operations and text manipulation, respectively.

4
Special Characters
5 minutes

Special characters are symbols with specific meanings in programming, used for tasks like formatting and control functions.

Java Math

1
Java Math
10 mintues

Java Math is a class in the Java programming language that provides methods for performing basic numeric operations and mathematical functions.

Java Booleans

1
Java Booleans
10 mintues

Java Booleans represent a data type that can have one of two values: true or false.

Java If ... Else

1
If
10 mintues

Java If ... Else statements provide a mechanism for executing different code blocks based on the evaluation of a boolean expression.

2
else
5 minutes

The else statement in Java specifies a block of code to be executed if the condition in the if statement is false.

3
else if
5 minutes

The "else if" statement in Java allows you to specify additional conditions to be evaluated if the preceding "if" statement's condition is false.

4
Short Hand If...Else
10 mintues

Short Hand If...Else is a concise conditional statement used to execute a single line of code based on a condition, resembling a ternary operator.

5
Real-Life Examples
5 minutes

Real-life examples demonstrate practical applications or instances of concepts in everyday situations.

Java Switch

1
Java Switch
5 minutes

The Java switch statement allows you to select one of many code blocks to be executed based on the value of a variable or expression.

Java While Loop

1
While Loop
10 minutes

A while loop is a control flow statement that repeatedly executes a block of code as long as a specified condition is true.

2
Do/While Loop
5 minutes

The do/while loop in Java executes a block of code repeatedly until a specified condition becomes false, with the condition checked after each iteration.

3
Real-Life Examples
5 minutes

Real-life examples provide tangible instances or illustrations of concepts in practical contexts.

Java For Loop

1
For Loop
5 minutes

Remember to increment the variable utilized in the condition, or else the loop will continue indefinitely.

2
Nested Loops
5 minutes

Nested loops in Java allow for the creation of loop structures within other loop structures, enabling iterative processes to be executed in multiple dimensions.

3
For Each Loop
5 minutes

A "for each" loop is a programming construct that iterates over a collection of items, such as an array or a list, and performs a specific action for each item in the collection.

4
Real-Life Examples
5 minutes

Real-life examples illustrate concepts through practical, everyday scenarios.

Java Break / Continue

1
Java Break And Continue
5 minutes

In Java, the break statement is used to exit a loop prematurely, immediately terminating the loop's execution. Conversely, the continue statement is used to skip the current iteration of a loop and proceed to the next iteration.

Java Arrays

1
Arrays
5 minutes

Java Arrays are containers that store multiple values of the same type in a single variable. They have a fixed size and allow elements to be accessed using an index.

2
Loop Through An Array
5 minutes

Looping through an array involves iterating over each element in the array sequentially.

3
Real-Life Example
5 minutes

A real-life example illustrates a concept through a practical, everyday scenario.

4
Multidimensional Arrays
5 minutes

Multidimensional arrays are arrays containing two or more dimensions, often used to store data in a grid or matrix format.

Java Methods

1
Java Methods
5 minutes

Java methods are blocks of code that perform a specific task and can be called upon to execute their functionality.

2
Parameters
10 minutes

Parameters are variables that are passed into a function or method to influence its behavior or provide it with necessary data.

3
Return Values
5 minutes

Return values are the values that a function or method sends back to the calling code to communicate its results or provide output.

4
Java Method Overloading
5 minutes

Method overloading in Java allows you to define multiple methods with the same name but with different parameters.

5
Java Scope
5 minutes

Java scope refers to the visibility and accessibility of variables and methods within a program.

 

6
Java Recursion
10 minutes

Java recursion involves a method calling itself to solve problems by breaking them down into smaller, similar subproblems.

Java Classes

1
Java OOP
5 minutes

A Java loop is a programming construct that repeatedly executes a block of code until a specified condition is met.

 

Class

Fruit

 

objects

Apple

Banana

Mango

 

Another example:

 

Class

Car

 

objects

Volvo

Audi

Toyota

 

Therefore, a class serves as a blueprint for objects, while an object represents an instance of a class.

Upon creation, objects inherit all variables and methods from the class.

Further insights into classes and objects will be covered in the upcoming chapter.

 

2
Java classes / Objects
5 minutes

Java classes define the structure and behavior of objects, while objects are instances of classes.

3
Java Class Attributes
10 minutes

Java class attributes represent the data members or fields of a class that define its state.

4
Java Class Methods
10 minutes

Java class methods are functions defined within a class that operate on class attributes and perform specific tasks

5
Java Constructors
5 minutes

Java constructors are special methods within a class used for initializing objects.

6
Java Modifiers
15 minutes

Java modifiers are keywords that provide additional information about classes, methods, variables, and other elements in a Java program, controlling their accessibility, behavior, and usage.

7
Java Encapsulation
10 minutes

Java encapsulation: controlling access to an object's components to protect its internal state.

8
Java Packages/ API
10 minutes

Java packages provide a way to organize and encapsulate a group of related classes and interfaces.

9
Java Inheritance
10 minutes

Java inheritance is a mechanism wherein a class (subclass) inherits properties and behaviors from another class (superclass), facilitating code reuse and hierarchical organization.

10
Java Polymorphism
5 minutes

Java polymorphism enables objects of different classes to be treated as objects of a common superclass through method overriding.

11
Java Inner Classes
5 minutes

Java inner classes are classes defined within other classes, providing a way to logically group classes and improve encapsulation and code organization.

12
Java Abstraction
5 minutes

Java abstraction is the process of hiding implementation details and showing only essential features of an object to the outside world.

13
Java Interface
5 minutes

A Java interface defines a contract for classes to implement, specifying a set of methods without providing their implementation details.

14
Java Enums
5 minutes

Java enums provide a way to define a fixed set of constants, ensuring type safety and clarity in code.

15
Java User Input
5 minutes

Java user output is the display of information generated by a Java program, typically through the console, graphical user interface (GUI), or other output streams.

16
Java Dates
5 minutes

Java Date and Time refer to the classes and APIs provided by Java for manipulating dates, times, and time zones in applications.

17
Java Array list
10 minutes

An ArrayList is a dynamically resizable implementation of the List interface in Java, allowing for flexible storage of elements in a sequential order.

18
java Linked List
10 minutes

A Java LinkedList is a linear data structure that consists of a sequence of elements where each element points to the next element in the sequence.

19
Java Hash Map
5 minutes

A Java HashMap is a data structure that stores key-value pairs, providing constant-time performance for basic operations like insertion, deletion, and retrieval, based on the hashCode of the keys.

20
Java HashSet
10 minutes

A Java HashSet is a collection that stores unique elements, utilizing hashing to achieve constant-time performance for basic operations like add, remove, and contains.

21
Java Iterator
5 minutes

A Java iterator is an object facilitating sequential traversal of collections, enabling access to elements and supporting operations like removal.

22
Java Wrapper Classes
5 minutes

Java wrapper classes are objects that encapsulate primitive data types, providing utility methods and enabling them to be used in object-oriented contexts.

23
Java Exception
5 minutes

A Java exception is an event that disrupts the normal flow of a program's execution, typically due to errors or unexpected conditions, which must be handled to prevent program termination.

24
Java RegEx
10 minutes

A regular expression (regex) is a series of characters defining a pattern for searching, utilized to match strings within text.

25
Java Threads
5 minutes

Java threads are the smallest units of execution within a Java program, allowing concurrent execution of tasks.

26
Java Lambda
5 minutes

Java lambda expressions provide a concise way to represent anonymous functions, enabling the implementation of functional interfaces with a more compact syntax.

Java file Handling

1
Java Files
10 minutes

Java files are text files containing source code written in the Java programming language, typically saved with a ".java" extension.

2
Java Create / Write Files
5 minutes

In Java, creating files involves using classes and methods from the java.io package to create, manipulate, and manage files within the file system.

3
Java read Files
5 minutes

In Java, reading files involves using classes and methods from the java.io package to access and extract data stored within files.

4
Java delete Files
10 minutes

In Java, deleting files involves using methods from the java.io.File class to remove files from the file system.

Java How To

1
Add Two Numbers
5 minutes

In Java, you can add numbers using arithmetic operators such as "+".

2
Count Words
5 minutes

Counting words involves determining the number of individual words present within a text or document.

3
Reverse a string
5 minutes

In Java, reversing a string involves rearranging the characters of a string in the opposite order.

4
Sum of Array Elements
5 minutes

In Java, finding the sum of array elements involves adding together all the values stored within the array.

5
Convert a String to Array
5 minutes

To convert a string to an array in Java, use the split method: String[] array = string.split("delimiter");.

6
Sort an Array
5 minutes

To sort an array in Java, use Arrays.sort(array);.

7
Find Array Average
5 minutes

Average is the sum of array elements divided by the number of elements.

8
Find Smallest Element
5 minutes

To find the smallest element in an array in Java, utilize Arrays.stream(array).min().getAsInt();.

9
ArrayList Loop
5 minutes

To loop through an ArrayList in Java, use a for-each loop or an iterator.

10
Loop Through a HashMap
5 minutes

To loop through a HashMap in Java, use a for-each loop or iterate over its key-value pairs using the entrySet() method.

11
Loop Through an Enum
5 minutes

To loop through an Enum in Java, use the values() method followed by a for-each loop.

12
Area of rectangle
3 minutes

In Java, you can calculate the area of a rectangle by multiplying its length by its width.

13
Even Or Odd Numbers
3 minutes

In Java, you can determine whether a number is even or odd by checking if it is divisible by 2 without a remainder.

14
Positive or Negative
5 minutes

Positive refers to something characterized by the presence or possession of favorable attributes, while negative denotes the absence or opposite of such attributes.

15
Square Root
5 minutes

The square root of a number is the value which, when multiplied by itself, yields the original number.

16
Random Number
5 minutes

A random number is a value selected from a set without any discernible pattern or predictability.

Java Reference

1
Java Reference
5 minutes

This section contains a Java reference documentation.

2
Java Keywords
5 minutes

Java keywords are reserved words that have predefined meanings in the Java programming language and cannot be used as identifiers.

3
assert
5 minutes

Assert is a programming statement used to validate assumptions or conditions within code, halting execution if the condition is false.

4
abstract
5 minutes

In Java, the "abstract" keyword is used to declare a class or method that must be subclassed or overridden, respectively, and cannot be instantiated on its own.

5
boolean
5 minutes

In Java, the "boolean" keyword is a primitive data type representing true or false values.

6
break
5 minutes

In Java, the "break" keyword is used to exit a loop or switch statement prematurely.

7
byte
5 minutes

In Java, the "byte" keyword defines a primitive data type representing 8-bit signed integers.

8
case
5 minutes

In Java, the "case" keyword is used within switch statements to specify different branches of execution based on the value of an expression.

9
catch
5 minutes

In Java, the "catch" keyword is used to handle exceptions in try-catch blocks by specifying code to execute when a particular exception occurs.

10
char
5 minutes

In Java, the "char" keyword denotes a primitive data type representing a single 16-bit Unicode character.

11
class
5 minutes

The "class" keyword in Java is used to declare a new class, which serves as a blueprint for creating objects with defined attributes and behaviors.

12
continue
5 minutes

The "continue" keyword in Java is used to skip the rest of the current iteration of a loop and proceed to the next iteration.

13
default
5 minutes

In Java, the "default" keyword is used in switch statements to specify the block of code to be executed when none of the case expressions match the value of the switch expression.

14
do
5 minutes

In Java, the "do" keyword is used to start a do-while loop, which executes a block of code repeatedly until a specified condition becomes false, with the block of code executed at least once.

15
double
5 minutes

In Java, the "double" keyword is a data type used to declare variables that hold double-precision floating-point numbers.

16
else
5 minutes

In Java, the "else" keyword is used in conditional statements to execute a block of code when the preceding "if" condition evaluates to false.

17
enum
5 minutes

In Java, the "enum" keyword is used to declare a special type that defines a set of constants.

18
exports
5 minutes

Exports are goods or services produced in one country and sold to buyers in another country.

19
extends
5 minutes

In Java, the "extends" keyword is used to indicate that a class is inheriting from another class, enabling the subclass to inherit fields and methods from the superclass.

20
final
5 minutes

The Java "final" keyword denotes that a variable, method, or class cannot be modified or extended, serving as a form of restriction or immutability.

21
finally
5 minutes

The "finally" keyword in Java is used to define a block of code that is always executed, regardless of whether an exception is thrown or caught.

22
float
5 minutes

The "float" keyword in Java is used to declare single-precision 32-bit floating point variables.

23
for
5 minutes

The "for" keyword in Java initiates a loop structure for iterating over a range of values or collections.

24
if
5 minutes

The "if" keyword in Java is used to execute a block of code conditionally based on whether a specified condition evaluates to true.

25
implements
5 minutes

The "implements" keyword in Java is used in class declarations to indicate that the class implements one or more interfaces.

26
import
5 minutes

The "import" The "import" keyword in Java is used to include classes or entire packages into a Java program, allowing access to their functionalities.

27
instanceof
5 minutes

The "instanceof" keyword in Java is used to check whether an object is an instance of a particular class or interface.

28
int
5 minutes

The "int" keyword in Java is used to declare integer variables.

29
interface
5 minutes

The "interface" keyword in Java is used to declare a reference type that only contains abstract method signatures, constants, and default methods.

30
long
5 minutes

The "long" keyword in Java is used to declare integer variables capable of storing larger whole numbers than the "int" data type, ranging from -9223372036854775808 to 9223372036854775807.

31
module
5 minutes

A module is a file containing Python code (definitions and statements) that can be imported and used in other Python programs.

32
native
5 minutes

The native keyword in Java indicates that a method is implemented in platform-specific native code, typically using languages like C or C++.

33
new
5 minutes

The "new" keyword in Java is used to create new objects or instances of classes.

34
package
5 minutes

The "package" keyword in Java is used to declare a package, which is a grouping mechanism for organizing related classes and interfaces.

35
private
5 minutes

The "private" keyword in Java is used to restrict access to members (variables and methods) within the same class.

36
protected
5 minutes

The "protected" keyword in Java is an access modifier used for class members (variables and methods) that allows access within the same package or by subclasses, regardless of package.

37
public
5 minutes

The "public" keyword in Java is an access modifier used to declare members (variables and methods) that can be accessed from any other class.

38
return
5 minutes

The "return" keyword in Java is used to exit a method and return a value to the caller.

39
requires
5 minutes

The requires keyword in Java specifies dependencies on other modules within a module.

40
short
5 minutes

The "short" keyword in Java is used to declare integer variables capable of storing smaller whole numbers than the "int" data type, ranging from -32,768 to 32,767.

41
static
5 minutes

The "static" keyword in Java is used to declare members (variables and methods) that belong to the class itself, rather than to instances of the class.

42
super
5 minutes

The "super" keyword in Java is used to access members (variables and methods) of the superclass within a subclass, or to invoke the superclass constructor.

43
switch
5 minutes

The "switch" keyword in Java is used to select one of many code blocks to be executed, based on the value of an expression.

44
synchronized
5 minutes

The synchronized keyword in Java ensures that only one thread can access a block of code or method at a time, preventing concurrent modification or data corruption.

45
this
5 minutes

The "this" keyword in Java refers to the current object instance within a class, used to distinguish between instance variables and parameters with the same name.

46
throw
5 minutes

The "throw" keyword in Java is used to explicitly throw an exception within a method or constructor.

47
throws
5 minutes

The "throws" keyword in Java is used in method declarations to indicate that the method may throw one or more specified exceptions.

48
transient
5 minutes

"Transient" typically refers to something temporary, fleeting, or not lasting for a long time.

49
try
5 minutes

The "try" keyword in Java is used to define a block of code within which exceptions may occur, and to catch and handle those exceptions.

50
var
5 minutes

"Var" is a keyword used to declare a variable with inferred type based on the assigned value.

51
void
5 minutes

The "void" keyword in Java is used to indicate that a method does not return any value.

52
volatile
5 minutes

The volatile keyword ensures that a variable's value is always read from and written to the main memory, providing visibility guarantees for changes made by one thread to be visible to others.

53
while
5 minutes

The "while" keyword in Java is used to create a loop that executes a block of code repeatedly as long as a specified condition evaluates to true.

Java String Methods

1
Java String Methods
5 minutes

Java String Methods encompass a suite of built-in functions tailored for manipulating and querying strings in Java.

2
charAt()
5 minutes

The Java String charAt() method retrieves the character at a specified index position within the string.

3
codePointAt()
5 minutes

The codePointAt() method in Java returns the Unicode code point at the specified index of a string.

4
codePointBefore()
5 minutes

The codePointBefore() method in Java retrieves the Unicode code point value before the specified index in a string.

5
codePointCount()
5 minutes

The codePointCount() method in Java calculates the number of Unicode code points between two specified indices in a string.

6
compareTo()
5 minutes

The Java String compareTo() method compares two strings lexicographically.

7
compareToIgnoreCase()
5 minutes

The Java String compareToIgnoreCase() method compares two strings lexicographically, ignoring case differences, and returns an integer value indicating their relative order.

8
concat()
5 minutes

The Java String concat() method appends one string to the end of another string.

9
contains()
5 minutes

The contains() method in Java checks if a specific sequence of characters exists within a string, returning true if found, and false otherwise.

10
contentEquals()
5 minutes

The contentEquals() method in Java checks if the content of a string is equal to the content of another string, returning true if equal and false otherwise.

11
copyValueOf()
5 minutes

The Java String copyValueOf() method creates a new String by copying the character array's values.

12
endsWith()
5 minutes

The Java endsWith() method checks whether a string ends with a specified suffix and returns a boolean value indicating the result.

13
equals()
5 minutes

The Java equals() method compares the content of two strings and returns true if they are equal, false otherwise.

14
equalsIgnoreCase()
5 minutes

The Java String equalsIgnoreCase() method compares two strings while ignoring their case differences.

15
format()
5 minutes

The Java String format() method returns a formatted string using the specified format string and arguments.

16
getBytes()
5 minutes

The Java String getBytes() method converts the string into a byte array.

17
getChars()
5 minutes

The Java String getChars() method copies characters from a string into an array of chars.

18
hashCode()
5 minutes

The Java String hashCode() method returns the hash code value for the string.

19
indexOf()
5 minutes

The Java String indexOf() method returns the index of the first occurrence of a specified substring within the string.

20
isEmpty()
5 minutes

The Java String isEmpty() method checks if a string is empty, returning true if it contains no characters.

21
join()
5 minutes

The Java String join() method concatenates the elements of a given iterable with a delimiter.

22
lastIndexOf()
5 minutes

The Java String lastIndexOf() method finds the index of the last occurrence of a specified character or substring within the string.

23
length()
5 minutes

The Java String length() method returns the length of the string, i.e., the number of characters it contains.

24
matches()
5 minutes

The Java String matches() method checks whether a string matches a given regular expression.

25
offsetByCodePoints()
5 minutes

The Java String offsetByCodePoints() method calculates the index of a character in the string by counting code points.

26
regionMatches()
5 minutes

The Java String regionMatches() method checks if a substring within a string matches another substring from another string, allowing for case-sensitive or case-insensitive comparison.

27
replace()
10 mintues

The Java String replace() method replaces all occurrences of a specified character or substring within the string with another character or substring.

28
replaceAll()
5 minutes

The replaceAll() method in Java replaces all occurrences of a specified substring with another substring within a string.

 

29
replaceFirst()
5 minutes

The Java String replaceFirst() method replaces the first occurrence of a specified substring with another substring.

30
split()
5 minutes

The Java String split() method divides a string into an array of substrings based on a specified delimiter.

31
startsWith()
5 minutes

The Java String startsWith() method checks whether a string starts with a specified prefix.

32
subSequence()
5 minutes

The Java String subSequence() method returns a CharSequence representing a part of the original string, specified by the start and end indices.

33
substring()
5 minutes

The Java String substring() method extracts a portion of a string based on specified start and end indices, returning the resulting substring.

34
toCharArray()
5 minutes

The Java String toCharArray() method converts a string into an array of characters.

35
toLowerCase()
5 minutes

The Java String toLowerCase() method converts all characters in a string to lowercase.

36
toString()
5 minutes

The toString() method in Java converts an object into a string representation.

37
toUpperCase()
5 minutes

The toUpperCase() method in Java converts all characters in a string to uppercase.

38
trim()
5 minutes

The trim() method in Java removes leading and trailing whitespaces from a string. Here's its one-liner usage:

39
valueOf()
5 minutes

The valueOf() method in Java converts different types of data into a string representation. Here's its one-liner usage:

Java Math Methods

1
Java Math Methods
10 mintues

The Java Math class offers a variety of methods for performing mathematical operations on numbers.

2
abs()
10 mintues

The Java Math `abs()` method returns the absolute value of a number.

3
acos()
10 mintues

The Java Math `acos()` method returns the arccosine of a value in radians.

4
addExact()
10 mintues

The addExact() method in Java's Math class computes the sum of its arguments, throwing an ArithmeticException if the result overflows an int or long data type.

5
asin()
5 minutes

The Java Math asin() method returns the arcsine of a value, in radians, within the range of -π/2 through π/2.

6
atan()
5 minutes

The Java Math atan() method returns the arctangent of a value, in radians, within the range of -π/2 through π/2.

7
atan2()
5 minutes

The Java Math atan2() method returns the angle theta from the conversion of rectangular coordinates (x, y) to polar coordinates (r, theta), in radians.

8
cbrt()
5 minutes

The Java Math cbrt() method returns the cube root of a double value.

9
ceil()
5 minutes

The Java Math ceil() method returns the smallest (closest to negative infinity) double value that is greater than or equal to the argument and is equal to a mathematical integer.

10
copySign()
5 minutes

The Java Math copySign() method returns a value with the magnitude of the first argument and the sign of the second argument.

11
cos()
5 minutes

The Java Math cos() method returns the cosine of an angle in radians.

12
cosh()
5 minutes

The Java Math cosh() method calculates the hyperbolic cosine of a value.

13
decrementExact()
5 minutes

The Java Math decrementExact() method decrements a given value by one, throwing an exception if the result overflows.

14
exp()
5 minutes

The Java Math exp() method computes the exponential value of a given number.

15
expm1()
5 minutes

The Java Math expm1() method computes ��−1 for a given input �.

16
floor()
5 minutes

The Java Math floor() method returns the largest integer less than or equal to a given number.

17
floorDiv()
5 minutes

The Java Math floorDiv() method computes the largest integer quotient of dividing two numbers.

18
floorMod()
5 minutes

The Java Math floorMod() method computes the remainder of dividing two numbers with floor division.

19
getExponent()
5 minutes

The Java Math getExponent() method retrieves the exponent of a floating-point number in IEEE 754 format.

20
hypot()
5 minutes

The Java Math hypot() method calculates the hypotenuse of a right triangle given its two perpendicular sides as arguments.

21
IEEEremainder()
5 minutes

The Java Math IEEEremainder() method computes the remainder of division between two numbers following the IEEE 754 standard.

22
incrementExact()
5 minutes

The Java Math incrementExact() method increments the given integer value by one, throwing an ArithmeticException if overflow occurs.

23
log()
5 minutes

The Java Math log() method returns the natural logarithm (base e) of a double value.

24
log10()
5 minutes

The Java Math log10() method computes the base-10 logarithm of a double value.

25
log1p()
5 minutes

The Java Math log1p() method computes the natural logarithm (base e) of the sum of the argument and 1.

26
max()
5 minutes

The Java Math max() method returns the greater of two values, passed as arguments.

27
min()
5 minutes

The Java Math min() method returns the smaller of two values, passed as arguments.

28
multiplyExact()
5 minutes

The Java Math multiplyExact() method calculates the product of two integers, throwing an ArithmeticException if the result overflows an integer.

29
negateExact()
5 minutes

The Java Math negateExact() method calculates the negation of an integer value, throwing an ArithmeticException if the result overflows the integer range.

30
nextAfter()
5 minutes

The Java Math nextAfter() method returns the floating-point number adjacent to a given value in the direction of another value.

31
nextDown()
5 minutes

The Java Math nextDown() method returns the floating-point number adjacent to a given value in the direction of negative infinity.

32
nextUp()
5 minutes

The Java Math nextUp() method returns the floating-point number adjacent to a given value in the direction of positive infinity.

33
pow()
5 minutes

The Java Math pow() method calculates the value of a base raised to the power of an exponent.

34
random()
5 minutes

The Java Math random() method generates a random double value between 0.0 (inclusive) and 1.0 (exclusive).

35
rint()
5 minutes

 

The Java Math rint() method returns the closest integer to a given floating-point value, rounding to the nearest whole number.

36
round()
5 minutes

The java.lang.Math.round() is used round of the decimal numbers to the nearest value. This method is used to return the closest long to the argument, with ties rounding to positive infinity.

37
scalb()
5 minutes

The Java Math scalb() method scales a given value by a specified power of 2.

38
signum()
5 minutes

The Java Math signum() method returns the signum function of the argument, indicating whether it's negative, positive, or zero.

39
sin()
5 minutes

The Java Math sin() method calculates the sine of an angle given in radians.

40
sinh()
5 minutes

The Java Math sinh() method computes the hyperbolic sine of a given angle.

41
sqrt()
5 minutes

The Java Math sqrt() method calculates the square root of a given number.

42
subtractExact()
5 minutes

The Java Math subtractExact() method computes the difference of two integers, throwing an exception if overflow occurs.

43
tan()
5 minutes

The tan() method returns the tangent of an angle. 

44
tanh()
5 minutes

The Java Math tanh() method computes the hyperbolic tangent of a given angle.

45
toDegrees()
5 minutes

The Java Math toDegrees() method converts an angle measured in radians to degrees.

46
toIntExact()
5 minutes

The Java Math toIntExact() method converts a long value to an int, throwing an exception if the value overflows an int.

47
toRadians()
5 minutes

The Java Math toRadians() method converts an angle measured in degrees to radians.

48
ulp()
5 minutes

The Java Math ulp() method returns the size of the smallest positive value that can be represented by the data type of the argument.

Java Output Methods

1
Java Output Methods
5 minutes

Java Output Methods refer to the various ways in which data can be displayed or printed to the console or other output streams in Java programs.

2
print()
5 minutes

The Java Output print() method writes text or values to the console without appending a newline character.

3
printf()
10 minutes

Display some formatted text on the console.

4
println()
5 minutes

The Java Output println() method writes text or values to the console, appending a newline character at the end.

Java Arrays Methods

1
Java Arrays Methods
5 minutes

The Java Arrays Class provides static methods to work with arrays, including sorting, searching, and filling arrays.

In the java.util package, the Arrays class offers methods for manipulating arrays.

2
compare()
5 minutes

The compare() method is used to compare two objects and return an integer indicating their order (negative if the first is less, zero if equal, positive if the first is greater).

3
equals()
5 mintues

The 'Arrays.equals()' method in Java determines if two arrays are equal in content.

4
sort()
5 mintues

The 'Arrays.sort()' method in Java arranges the elements of an array in ascending order.

5
fill()
5 minutes

The 'Arrays.fill()' method in Java assigns a specified value to each element of an array.

6
length
2 minutes

The 'length' property in Java arrays returns the number of elements in the array.

Java ArrayList Methods

1
Java ArrayList Methods
10 minutes

Java ArrayList methods provide various functionalities to manipulate the elements, such as adding, removing, accessing, and iterating over elements.

2
add()
5 minutes

The add() method appends an item to the end of the list.

3
addAll()
10 minutes

The addAll() method adds all elements from a collection to the list.

4
clear()
10 minutes

The clear() method removes all elements from the list.

5
clone()
10 minutes

clone() is a method in Java that creates and returns a copy of an object.

6
contains
5 minutes

contains() is a method in Java that checks whether a collection contains a specified element, returning true if found, false otherwise.

7
ensureCapacity()
10 minutes

ensureCapacity() is a method in Java that increases the capacity of an ArrayList to ensure it can accommodate a specified number of elements without needing to resize the internal data array multiple times.

8
forEach()
10 minutes

forEach() is a method in Java that iterates over elements in a collection, applying a specified action to each element.

9
get()
10 minutes

get() retrieves the element at a specified index from a list in Java.

10
indexOf()
10 minutes

indexOf() is a method in Java that returns the index of the first occurrence of a specified element in a list, or -1 if the element is not found.

11
isEmpty()
10 minutes

isEmpty() is a method in Java that checks if a list is empty, returning true if it contains no elements, false otherwise.

12
iterator()
10 minutes

iterator() is a method in Java that returns an iterator over the elements in a collection, allowing sequential traversal of the elements.

13
lastIndexOf()
10 minutes

lastIndexOf() is a method in Java that returns the index of the last occurrence of a specified element in a list, or -1 if the element is not found.

14
listIterator()
10 minutes

listIterator() is a method in Java that returns a ListIterator for a list, allowing bidirectional traversal of the elements and modification of the list during iteration.

15
remove()
10 minutes

remove() is a method in Java that deletes the element currently being iterated over from a collection using an iterator, or removes the element at a specified index from a list.

16
removeAll()
10 minutes

removeAll() is a method in Java that removes all elements from a list that are also contained in a specified collection.

17
removeIf()
10 minutes

removeIf() is a method in Java that removes all elements from a list that satisfy a specified condition, as determined by a predicate.

18
replaceAll()
10 minutes

replaceAll() is a method in Java that replaces all elements in a list with the result of applying a specified function to each element.

19
retainAll()
10 minutes

The retainAll() method in Java collections retains only the elements in the collection that are contained in the specified collection, removing all others.

20
set()
10 minutes

A Set is a collection that contains no duplicate elements and has no guaranteed order.

21
size()
10 minutes

The size() method returns the number of elements in the list.

22
sort()
10 minutes

The sort() method arranges the elements of a list in ascending order, according to their natural ordering.

23
spliterator()
10 minutes

The spliterator() method creates a Spliterator over the elements in the list.

24
subList()
10 minutes

subList() is a method in Java that returns a view of a portion of a list, specified by a range of indexes.

25
toArray()
10 minutes

toArray() is a method in Java used to convert a collection or list into an array.

26
trimToSize()
10 minutes

trimToSize() is a Java ArrayList method that trims the capacity of the list to its current size.

Java LinkedList Methods

1
Java LinkedList Methods
10 minutes

Below is a table containing all LinkedList methods.

2
add()
10 minutes

The add() method inserts an item into the list.

3
addAll()
10 minutes

The addAll() method appends all items from a collection to the list.

4
clear()
10 minutes

The clear() method eradicates all items from the list.

5
clone()
10 minutes

The clone() method provides a duplicate of the LinkedList as an Object.

6
contains()
10 minutes

The contains() method returns true if an item is present in a list; otherwise, it returns false.

7
forEach()
10 mintues

The forEach() method executes an action on each item within a list.

8
get()
10 minutes

The get() method retrieves the item located at a specified position within the list.

9
getFirst()
10 minutes

The getFirst() method retrieves the first item in a list.

10
getLast()
10 mintues

The getLast() method retrieves the last item in a list.

 

11
indexOf()
10 mintues

The indexOf() method retrieves the index of the first occurrence of a value in the list. If the item is not present in the list, it returns -1.

12
isEmpty()
10 minutes

"isEmpty()" returns true if the list is empty; otherwise, it returns false.

13
iterator()
10 minutes

"iterator()" returns an iterator over the elements in the list.

14
lastIndexOf()
10 minutes

"lastIndexOf()" returns the index of the last occurrence of a specified element in the list, or -1 if it is not found.

15
listIterator()
10 minutes

"listIterator()" returns a ListIterator over the elements in the list.

16
remove()
10 minutes

"remove()" removes the current element from the list during iteration.

17
removeAll()
10 minutes

"removeAll()" removes all occurrences of specified elements from the list.

18
removeFirst()
10 minutes

"removeFirst()" removes and returns the first element of the list.

19
removeIf()
10 minutes

"removeIf()" removes all elements from the list that satisfy the given predicate.

20
removeLast()
10 minutes

"removeLast()" removes and returns the last element of the list.

21
replaceAll()
10 minutes

"replaceAll()" replaces each element in the list with the result of applying the specified operator.

22
retainAll()
10 minutes
23
set()
10 minutes

"set()" updates the element at the specified index in the list with a new value.

24
size()
10 minutes

size()" returns the number of elements in the list.

25
sort()
10 minute

"sort()" arranges the elements of the list in ascending order according to their natural ordering, or using a specified comparator.

26
spliterator()
10 minute

"spliterator()" creates a Spliterator over the elements in the list.

27
toArray()
5 minutes

toArray() is a method in Java used to convert a collection or a list into an array.

Java HashMap Methods

1
Java HashMap Methods
10 minutes

Java HashMap methods provide operations for storing, retrieving, and managing key-value pairs in a hash table.

2
clear()
10 minutes

The clear() method in HashMap removes all mappings from the map in a single operation.

3
clone()
10 minutes

The clone() method in HashMap creates and returns a shallow copy of the map instance.

4
compute()
10 minutes

In programming, compute() is a function used to perform calculations or process data based on given inputs and return the result.

5
computeIfAbsent()
10 minutes

computeIfAbsent() updates a map by computing and inserting a value for a key if the key is not already associated with a value.

6
computeIfPresent()
10 minutes

computeIfPresent() updates a map by computing a new value for an existing entry if the entry's key is present and its current value is not null.

7
containsKey()
10 minutes

containsKey() checks if a map contains a specific key and returns true if found, false otherwise.

8
containsValue()
10 minutes

containsValue() checks if a map contains a specific value and returns true if found, false otherwise.

9
entrySet()
10 minutes

entrySet() returns a set view of the mappings contained in the map.

10
forEach()
10 minutes

Each() isn't a standard method in programming, but if you're referring to its general usage, it typically represents iterating over each element/item in a collection, such as an array, list, or map.

11
get()

get() retrieves the value associated with a specified key in a map.

12
getOrDefault()
10 minutes

getOrDefault() retrieves the value associated with a specified key in a map, or returns a default value if the key is not present.

13
isEmpty()
10 minutes

isEmpty() checks if a map is empty and returns true if it contains no key-value mappings.

14
keySet()
10 minutes

keySet() returns a set view of the keys contained in the map.

15
merge()
10 minutes

merge() combines values under a specified key in a map using a specified merging function.

16
put()
10 minutes

put() inserts a new key-value pair into a map or updates the value for an existing key.

17
putAll()
10 minutes

putAll() copies all of the mappings from one map to another.

18
putIfAbsent()
10 minutes

putIfAbsent() inserts a key-value pair into a map only if the key is not already present.

19
remove()
10 minutes

The remove() method in Python is used to delete the first occurrence of a specified element from a list.

20
replace()
10 minutes

The replace() method in Python is used to replace the occurrences of a specified value with another value in a string.

21
replaceAll()
10 minutes

The replaceAll() method in Java is used to replace all occurrences of a specified value in a map with another value.

22
size()
10 minutes

The size() function returns the number of elements in a collection, such as an array, list, or set.

 

23
values()
10 mintues

The values() method returns a collection view of the values contained in a map.

Java Errors and Exception

1
Java Errors and Exception
5 minutes

Java Errors and Exceptions represent abnormal conditions or unexpected events that disrupt the normal flow of a program's execution.

Be the first to add a review.

Please, login to leave a review
Start course
Enrolled: 3 students
Lectures: 323
Level: Beginner

Archive

Working hours

Monday 9:30 am - 6.00 pm
Tuesday 9:30 am - 6.00 pm
Wednesday 9:30 am - 6.00 pm
Thursday 9:30 am - 6.00 pm
Friday 9:30 am - 5.00 pm
Saturday Closed
Sunday Closed
Java Basic
Category: