EDUCBA

EDUCBA

MENUMENU
  • Free Tutorials
  • Free Courses
  • Certification Courses
  • 600+ Courses All in One Bundle
  • Login

Windows Operators

By Priya PedamkarPriya Pedamkar

Home » Software Development » Software Development Tutorials » Software Development Basics » Windows Operators

windows operators

Introduction to Windows Operators

5 9 43 1 true false. These random numbers and text don’t make any sense, do they? No, they don’t. That’s because they lack operators. Any meaningful expression is a combination of variables and operators. An operator determines how the variables are connected through each other and how they would contribute to the end result. 5 + 9 – 43 < 1? true: false. Now it makes some sense. So let’s snorkel through the world of operators in Windows.

Classification of Windows Operators

These Windows Operators are broadly classified into three types. This classification is done based on the number of variables or operands an operator requires. The three types are:

Start Your Free Software Development Course

Web development, programming languages, Software testing & others

  • Unary Operators
  • Binary Operators
  • Ternary Operators

1. Unary Operators: They require a single operand.

E.g. Prefix and Postfix operators, Shorthand operators, Negation Operator etc

2. Binary Operators: They require two operands to calculate the result.

E.g. Arithmetic operators, logical operators etc.

3. Ternary Operators: They require three operands.

E.g. Ternary Conditional operator

Types of Windows Operators

The various types of windows operators, based on their functionality are:

1. Basic Arithmetic Operators

These windows operators perform mathematical calculations.

Plus operator (+): Adds or concatenates the two operands.

E.g.

  • Sum of two integers: 1+3 results in 4
  • Sum of two floating point numbers: 9.8+0.4 results in 10.2
  • Concatenation of two strings: “Hello”+”World” results in “Hello World”

Minus Operator (-): Subtracts the second operand from first. Doesn’t work on strings.

Popular Course in this category
All in One Software Development Bundle (600+ Courses, 50+ projects)600+ Online Courses | 3000+ Hours | Verifiable Certificates | Lifetime Access
4.6 (3,144 ratings)
Course Price

View Course

Related Courses
Windows 10 Training (4 Courses, 4+ Projects)JWS Java Web Services Training (4 Courses, 11 Projects)Java Training (40 Courses, 29 Projects, 4 Quizzes)

E.g.

  • Subtraction of two integers: 5-4 results in 1
  • Subtraction of two floating point numbers: 4.1 – 4.6 results in -0.5

Multiplication Operator (*): Multiplies the two operands.

E.g.

  • Multiplication of two integers: 9*5 results in 45
  • Multiplication of two floating point numbers: 1.1*2.3 results in 2.53

Division Operator (/): Divides the first operand by the second and returns the quotient as the result. The remainder is discarded. Some advanced languages, however, do not discard the remainder and keep dividing until a pre-set number of precision points is reached.

E.g.

  • Division of two integers: 45/11 results in 4
  • In advanced languages: 45/11 results in 4.090909

Modulus Operator (%): Divides the first operand by the second and returns the remainder as the result. The quotient is discarded. Doesn’t work on floating point numbers.

E.g.

  • Modulus of two integers: 45/11 results in 1

2. Assignment Operator (=)

Assigns the result calculated in the right-hand side of the operator (RHS) to the left-hand variable (LHS). The left of the operator should always be a variable and not a constant/expression.

E.g.

  • x = 5, assigns value 5 to x.
  • 5 = x is invalid as left-hand side is a constant.
  • y = x*4 calculates x*4 and assigns to y. Thus, y now holds the value 20
  • x*4 = y is invalid as the left-hand side is an expression.

3. Comparison Operators

They compare the value of the first operand with that of the second operand and returns either true or false. These are less than (<), greater than (>), less than or equal (<=), greater than or equal (>=), equal (==), not equal (!=).

E.g.

  • 61>45, returns true.
  • 3==3, returns true.

4. Prefix and Postfix Operators

These windows operators increment or decrement the value of an operand by 1. They work only on integers.

E.g.

  • x=5

x++, x is now 6

–x, x is now 5 again

Seems simple, right? There is a very significant difference in the functioning of the two operators. Prefix operators change the value of the operand before evaluating the expression, whereas the postfix operator changes the value after the expression has been evaluated.

  • x = 5

print(x++), this will print 5 and then change the value of x to 6

print(++x), this will increment the value from 6 to 7 and then print 7.

5. Shorthand Operators

These windows operators are a combination of two operators. The result is calculated using the existing value of the operand and assigned back to itself. They help minimize the lines of code written. The most common shorthand operators are:

  • +=: This is equivalent to addition and assignment.
  • -=: This is equivalent to subtraction and assignment.
  • *=: This is equivalent to multiplication and assignment.
  • /=: This is equivalent to division and assignment.

E.g. – x+=5, is equivalent to x=x+5.

6. Logical Operators

Logical operators are mainly used to control the program flow. Usually, they help the compiler on which path to follow based on the outcome of a decision. They always result in boolean values

Logical AND (&&): Returns true if the conditions on both left and right side of the operator are true, otherwise returns false.

E.g.

  • (2>3) && (4<5) returns false. Reason, 2 is not greater than 3
  • Boolean b1 = true
    Boolean b2 = true
    b1 && b2 returns true.

Logical OR (||): Returns true if any of the operands is true, otherwise returns false.

E.g.

  • (2>3) || (4<5) returns true
  • Boolean b1 = false
    Boolean b2 = false
    b1 || b2 returns false.

Logical NOT / Negation (!): Inverses the result of the operand i.e. true becomes false and false becomes true.

E.g.

  • ! (2>3) returns true
  • ! (2>3) && (4<5) returns true. Reason -! (2>3) results in true.

7. Bitwise Operators

Bitwise operators are a special category of operators as they do not operate in a conventional way. While all other operators operate on bytes, bitwise operators operate on bits. Don’t panic. They may sound tough but are easy to understand through examples.

E.g.

Let us assume we have two numbers 2 and 4. Their respective binary conversions would be 0010 and 0100. Since 1 byte contains 8 bits, we convert them to 0000 0010 and 0000 0010.

  • Bitwise AND (&): 2 & 4 results in 0000 0000 which is simply 0
  • Bitwise OR (|): 2 | 4 results in 0000 0110 which is 6
  • Bitwise NOT (~): ~2 results in 1111 1101 which is -125 most significant bit are the sign bit

Note: Bitwise operators are a vast topic in themselves and they play a key role in the communication industry. It is recommended to deep dive in bitwise operators for a better understanding.

8. Ternary Operator

The ternary operator is a shorthand operator for a logical if and else program flow. It evaluates the expression on the left of the question mark (?) and based on the result (true/false) the operations on the left and right of the colon (:) are performed.

E.g. – (condition)? (operation if true): (operation if false)

  • (5>9) ? (print true): (print false) false is printed.

9. Operator Precedence

The precedence of operators is as follows (highest to lowest priority):

  • Brackets
  • Prefix and Postfix operators
  • Multiplication, Division, Modulus
  • Addition, Subtraction
  • Bitwise Operators
  • Logical Operators (some logical operators take higher precedence than bitwise operators. Learn more when you deep dive in bitwise operator section.)
  • Ternary Operator
  • Assignment, Shorthand operators

Recommended Articles

This has been a guide to Windows Operator. Here we have discussed the different type of windows operators with examples. You can also go through our other suggested articles to learn more –

  1. Tips for Windows 10
  2. Ubuntu vs Windows 10
  3. MySQL Operators
  4. Windows Interview Questions

All in One Software Development Bundle (600+ Courses, 50+ projects)

600+ Online Courses

3000+ Hours

Verifiable Certificates

Lifetime Access

Learn More

0 Shares
Share
Tweet
Share
Primary Sidebar
Computer Tutorial
  • Computer Basics
    • New Technologies of Computer
    • Application of Computer Graphics
    • Types of Computer Architecture
    • Types of Computer Software
    • Line Drawing Algorithm
    • SOAP Web Services Interview Questions
    • Web Services Interview Questions
    • Microservices Interview Questions
    • What is Windows 10?
    • Windows 10 Desktop Mode
    • Windows Commands  
    • Windows Interview Questions
    • Windows Networking Commands
    • Windows Operators
    • Windows Server Interview Questions
    • Introduction to Windows
    • Top Windows Phone Apps
    • Windows Monitoring Tool
    • Productivity tricks for Windows 10
    • Computer Network Advantages and Disadvantages
    • Computer Network Interview Questions
    • Introduction To Computer Network
    • What is Embedded Systems
    • Components of Embedded System
    • Embedded Systems Security
    • Types of Computer Network
    • Types of Computer Operating System
    • Evolution of Operating System
    • NAS Storage Device
    • Windows Administrator Interview
    • Types of Communication Network
    • What is Automata
    • Types of Mainframe Computers
    • Types of Computer Hardware
    • Types of Sensors
    • What is Server
    • What is RPC
    • What is Microservices
    • Types of Computer Virus
    • Types of Computer Keyboard
    • Types of Motherboard
    • Sensor Device
    • What is Computer Graphic Design
    • Computer Architecture Interview
    • What is Computer Science?
    • What is Bluetooth?
    • What is VLAN?
    • Types of VLAN
    • Types of LAN
    • How does LAN switches work
    • What is VLAN Network?
    • What is Native VLAN?
    • How does LAN Switches work?
    • Switching Modes
    • What is Storage?
    • What is Object Storage?
    • What is Block Storage?
    • Block Level Storage
    • Cordova Local Storage
    • Threads in Operating System
    • What is Gateway?
    • What is Ethernet?
    • What is Virtual Machine?
    • What is a Trunk Port?
    • VPN Applications for Android
    • What is a NAS Drive?
    • What is Ring Topology?
    • Point to Point Topology
    • What is Mesh Topology?
    • Extended Star Topology
    • Token Ring Topology
    • Physical Topology
    • What is a Hybrid Topology?
    • Hybrid Network Topology
    • Star Network Topology
    • Star Bus Topology
    • Zariski Topology
    • Ethernet Topology
    • Logical Topology
    • Partial Mesh Topology
    • Types of Computer Cables
    • Types of Computer Language
    • Features of Operating System
    • Functions of Operating System
    • Multithreading in Operating System
    • Ethernet Frame Format
    • Types of Memory in Computer
    • What is Heap Memory?
    • What is Register?
    • Types of Registers
    • What is Arduino?
    • Arduino Operators
    • What is iSCSI?
    • Computer Science Interview Questions
    • Types of USB Ports
    • What is Port
    • Daisy Chain Network
    • What is a Monitor?
    • What is Printer?
    • Types of Printers
    • What is WPS
    • What is Mouse?
    • Types of Socket
    • Transmission Modes
    • Computers Output Devices
    • Memory Units
    • Secondary Memory
    • What is Memory Card?
    • Types of Memory Cards
    • What is Intranet?
    • Central Processing Unit
    • Computer Ports
    • What is CPU Register
    • Types of CPU
    • Types of Compact Disc
    • Cache Memory Types
    • What is a Motherboard?
    • Types of LED
    • Types of Processor
    • Types of Primary Memory
    • Helpdesk Tool
    • What is Optical Fiber?
    • Windows 10 creation tool

Related Courses

Windows 10 Training Course

Java Web Services Training Course

Java Training Course

Footer
About Us
  • Blog
  • Who is EDUCBA?
  • Sign Up
  • Corporate Training
  • Certificate from Top Institutions
  • Contact Us
  • Verifiable Certificate
  • Reviews
  • Terms and Conditions
  • Privacy Policy
  •  
Apps
  • iPhone & iPad
  • Android
Resources
  • Free Courses
  • Java Tutorials
  • Python Tutorials
  • All Tutorials
Certification Courses
  • All Courses
  • Software Development Course - All in One Bundle
  • Become a Python Developer
  • Java Course
  • Become a Selenium Automation Tester
  • Become an IoT Developer
  • ASP.NET Course
  • VB.NET Course
  • PHP Course

© 2020 - EDUCBA. ALL RIGHTS RESERVED. THE CERTIFICATION NAMES ARE THE TRADEMARKS OF THEIR RESPECTIVE OWNERS.

EDUCBA Login

Forgot Password?

EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you
Book Your One Instructor : One Learner Free Class

Let’s Get Started

This website or its third-party tools use cookies, which are necessary to its functioning and required to achieve the purposes illustrated in the cookie policy. By closing this banner, scrolling this page, clicking a link or continuing to browse otherwise, you agree to our Privacy Policy

EDUCBA

*Please provide your correct email id. Login details for this Free course will be emailed to you
EDUCBA
Free Software Development Course

Web development, programming languages, Software testing & others

*Please provide your correct email id. Login details for this Free course will be emailed to you

Special Offer - All in One Software Development Bundle (600+ Courses, 50+ projects) Learn More