280
Heart Pattern in Java
Heart Pattern is another complex pattern program that is rarely asked by the interviewers because of its complexity.
We print two types of heart patterns, i.e., a simple heart and some text inside the heart. We take the help of the Math class and the lineSeparator() method of the System. Let’s implement the code of both types of hearts. and understand the use of Math class and lineSeparator().
HeartPatternExample1.java
Output:
HeartPatternExample2.java
Output:
Next TopicHow to check data type in Java