diff --git a/client/src/guide/english/java/built-in-functions/index.md b/client/src/guide/english/java/built-in-functions/index.md index 883e80a9be..16c3e43e72 100644 --- a/client/src/guide/english/java/built-in-functions/index.md +++ b/client/src/guide/english/java/built-in-functions/index.md @@ -10,4 +10,32 @@ import java.lang.*; import java.io.*; ``` -These comprise functions which make an otherwise long and hard task easier to do. +These comprise functions which make an otherwise long and hard task easier to do. + +Some examples of ```java.lang.* ``` are: + +Generating a random number using Math. In this example a random integer from 1 - 10 +```java +int randomNumber = (int) (Math.random() * 10) + 1; +``` +Usage of primitive types such as double, float, int boolean + +```java +int integerNumber = 1; +double doubleNumber = 0.1d; +float floatNumber = 0.2f; +boolean trueOrFalse = false; +``` + + +Classes in ```java.io.* ``` are mainly used for reading and writing of files with diffrent methods such as Input / output streams and buffered readers/ writers. +And example using a buffered reader is below: + +```java + File file = new File("C:\\Users\\Desktop\\test.txt"); + BufferedReader br = new BufferedReader(new FileReader(file)); + String st; + while ((st = br.readLine()) != null) + System.out.println(st); +``` +