Série: Java Old
java
51 linhas
· Atualizado 2026-02-03
B.java
Java_Old/projects/abc_project/B.java
/**
* B.java - Utility class providing mathematical operations
*
* This class is used by A.java to perform various utility functions
*/
public class B {
/**
* Adds two integers
* @param a first number
* @param b second number
* @return sum of a and b
*/
public int add(int a, int b) {
return a + b;
}
/**
* Multiplies two integers
* @param a first number
* @param b second number
* @return product of a and b
*/
public int multiply(int a, int b) {
return a * b;
}
/**
* Checks if a number is even
* @param number the number to check
* @return true if number is even, false otherwise
*/
public boolean isEven(int number) {
return number % 2 == 0;
}
/**
* Calculates the power of a number
* @param base the base number
* @param exponent the exponent
* @return base raised to the power of exponent
*/
public int power(int base, int exponent) {
int result = 1;
for (int i = 0; i < exponent; i++) {
result *= base;
}
return result;
}
}
Artigos relacionados
Java Old
java
Atualizado 2026-02-03
Main.java
Main.java — java source code from the Java Old learning materials (Java_Old/Main.java).
Ler artigo →
Java Old
java
Atualizado 2026-02-03
Student.java
Student.java — java source code from the Java Old learning materials (Java_Old/Student.java).
Ler artigo →
Java Old
java
Atualizado 2026-02-03
01_Generics.java
01_Generics.java — java source code from the Java Old learning materials (Java_Old/advanced/01_Generics.java).
Ler artigo →
Java Old
java
Atualizado 2026-02-03
02_Collections.java
02_Collections.java — java source code from the Java Old learning materials (Java_Old/advanced/02_Collections.java).
Ler artigo →
Java Old
java
Atualizado 2026-02-03
03_Streams.java
03_Streams.java — java source code from the Java Old learning materials (Java_Old/advanced/03_Streams.java).
Ler artigo →
Java Old
java
Atualizado 2026-02-03
CollectionsExample.java
CollectionsExample.java — java source code from the Java Old learning materials (Java_Old/advanced/CollectionsExample.java).
Ler artigo →