Display Special Characters in Java

Triangle pattern in java. In the Java programming language, a triangle pattern is used. Using the numbers in Java, this program will print the pattern. Although printing the pattern program is easy, doing the same thing with symbols is more difficult for beginners in Java

Pattern Definition

A pattern is a recurring pattern in the natural world, human-made design, or abstract ideas. As a result, a pattern’s elements repeat in a predictable manner. A geometric pattern is a repeating pattern made up of geometric shapes, similar to a wallpaper design. Patterns can be observed directly with any of the senses. 

For Loop in Java

In Java, the “for” loop is an entry-controlled loop that allows a user to iteratively execute a block of statement(s) for a set number of times. The test-condition given inside the “for” loop determines the number of iterations. The Java “for” loop is one of the most simple Java loops to grasp.

System.out.println in Java

println is a Java statement that prints the argument passed to System. out, which is usually stdout. println() is a Java System. out function that prints an argument passed to it. The statement can be broken down into three parts, each of which can be understood independently: System: It is a java class that is defined at the end.

public class Main
{ 
public static void main(String[] args) 
{ 
for (int i = 0; i <= 5; i++) 
{ 
int letters = 40; 
for (int j = 5; j > i; j--) 
{ 
System.out.print(" "); 
} 
for (int k = 0; k <= i; k++) 
{ 
System.out.print((char) (letters+ k) + " "); 
} 
System.out.println(); 
} 
} 
}

Output:

    ( )

   ( ) *  

  ( ) * + 

 ( ) * + , 

( ) * + , –