Posts

Conditional Operators

Image
  Conditional Operators--> Conditional Operators return one value if condition is true and returns another value if condition is false. This operator is also called ternary operator. Syntax: class ConditionalDemo {     public static void main(String []args) {    int value1 = 1;    int value2 = 2;    int result;    boolean somecondition = true;    result = somecondition?value1:value2;    System.out.println(result);     } } The syntax of ternary operator is testCondition?expression1:expression2; The testCondition is a boolean expression that results in either true or false. If the condition is: true: expression1 (before the colon) is executed. false: expression2 (before the colon) is executed. The ternary operator takes 3 operands (condition, expression1 and expression2). Hence the name ternary operator. import java.util.Scanner; class ConditionalDemo {     public static void main...

Introduction on OOPs

Image
  OOPs  is nothing, it is just a programming approach in which certain concept are given to make a program. If any language follows these concepts, then we said that language is Object Oriented Programming language. It has rules of making any programs in programming language. Each programming language has its own definition for OOPs. A language in which everything is represent in the form of object is known as pure Object Oriented Programming language. There are three main concepts: - Polymorphism Inheritance Encapsulation OOPs has Classes, Object, Data Abstraction, Dynamic Binding and others. We can learn all these concepts in this blog.