0% found this document useful (0 votes)
4 views2 pages

Java String and Math Class Methods

This document summarizes various string and math methods in Java. It provides examples of methods like trim(), startsWith(), endsWith(), charAt(), length(), intern(), valueOf(), replace() for strings and methods like max(), min(), abs(), round(), sqrt(), cbrt(), getExponent(), IEEEremainder(), addExact(), subtractExact(), multiplyExact(), incrementExact(), decrementExact(), nextUp(), nextDown(), ceil(), floor(), log(), sin(), cos(), tan(), asin() for math operations and shows their output.
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)
4 views2 pages

Java String and Math Class Methods

This document summarizes various string and math methods in Java. It provides examples of methods like trim(), startsWith(), endsWith(), charAt(), length(), intern(), valueOf(), replace() for strings and methods like max(), min(), abs(), round(), sqrt(), cbrt(), getExponent(), IEEEremainder(), addExact(), subtractExact(), multiplyExact(), incrementExact(), decrementExact(), nextUp(), nextDown(), ceil(), floor(), log(), sin(), cos(), tan(), asin() for math operations and shows their output.
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

JOEY BRANDELL CRUZ PROGIT2

BSIT – IDB3

STRING CLASS

Methods Example Output


trim() String s=" Burger "; (space)Burger(space)
[Link](s); Burger
[Link]([Link]());
startsWith() String s="Sausage"; true
endsWith() [Link]([Link]("Sa")); true
[Link]([Link]("e"));
charAt() String s="Cheese"; C
[Link]([Link](0)); s
[Link]([Link](4));
length() String s="Ketchup"; 7
[Link]([Link]());
intern() String s=new String("Balut"); Balut
String s2=[Link]();
[Link](s2);
valueOf() int a=19; 1910
String s=[Link](a);
[Link](s+10);
replace() String s1="I like me better, just me I like you better, just
and me."; you and you
String
replaceString=[Link]("me","you");
[Link](replaceString);

MATH CLASS

Method Example Output


[Link]() int x = 60; int y = 192; 192
[Link]([Link](x, y));
[Link]([Link](x, y));
[Link]() 60
[Link]() int x = 80, int y = -48; 80
[Link]([Link](x)); 48
[Link]([Link](y));
[Link]() double x = 30.59; 31
[Link]([Link](x));
[Link]() double x = 81.0, y = 729; 9.0
JOEY BRANDELL CRUZ PROGIT2
BSIT – IDB3

[Link]() [Link]([Link](x)); 9.0


[Link]([Link](x));
[Link]() double a = 50.45; 5
[Link]([Link](
a));
[Link]() double a = 387.1, b = 4.2; 0.7000000000000
[Link]([Link] 064
r(a, b));
[Link]() int a = 100; int b = 50; 150
[Link]() [Link]([Link](a, 100
[Link]() b)); 5000
[Link]
([Link](a, b));
[Link]() int a = 310; 311
[Link]( [Link]([Link] 309
) ct(a));
[Link]([Link]
act(a));
[Link]() double x = 744.93; 744.93000000000
[Link] [Link]([Link](x)); 01
wn() float a = 328.7f; 328.69998
[Link]([Link](a));
[Link]() double x = 83.56; 84.0
[Link]() [Link]([Link](x)); 83.0
[Link]([Link](x));
[Link]() double x = 38.9; 3.6609942506244
[Link]([Link](x)); 004
[Link]() double a = 60; 0.8660254037844
double b = [Link](a); 386
[Link]([Link](b));
[Link]() double a = 60; 0.5000000000000
double b = [Link](a); 001
[Link]([Link](b));
[Link]() double a = 45; 0.9999999999999
double b = [Link](a); 999
[Link]([Link](b));
[Link]() double a = 1.0; 1.5707963267948
[Link]([Link](a)); 966

You might also like