Answer:
public class Pyramid {
public static void main(String[] args) {
int h = 7;
System.out.println("Pattern A");
for(int i = 1; i <= h; ++i)
{
for(int j = 1; j <= i; ++j) {
System.out.print("+");
}
System.out.println();
}
System.out.println();
System.out.println("Pattern B");
for (int i = 1; i<=h; ++i)
{
for(int j = h; j >=i; --j){
System.out.print("+");
}
System.out.println();
}
}
}
Explanation:
- The trick in this code is using a nested for loop
- The outer for loop runs from i = 0 to the heigth of the triangle (in this case 7)
- The inner for loop which prints the (+) sign runs from j = 0 to j<=i
- It prints the + using the print() function and not println()
- In the pattern B the loop is reversed to start from i = height
Answer:
The last option i.e "A class is an instance of its object" is the correct answer of this question.
Explanation:
A class is a collection of variable and method . The class is the blueprint of the object that means class is physical space entity and object is a runtime space entity.It is the the reusability feature of the programming component.
Following are the syntax to declare any class.
Class classname
<u>For Example</u>: class test1
With the help of class we can achieve the inheritance, encapsulation and abstraction etc.
All the other options except the last one are correct option. Because option(1), option(2) and option(3) follow the property of class and object . that's why last option is False.
I don’t think we should because we all have our one choices that we should achieved and we should show
Answer:
graphic design and digital marketing solutions