Posts

Scanner class in JAVA

Image
Scanner class is used to take input from the user in java. It has many different methods to handle other task too. To use Scanner class you have to use  import java.util.Scanner;   then you have to create an object of Scanner class. After creating an object, you can use the scanner object to store variables from user. When user gives input it stores in it and later on we can assign the value in variable for further use. let't see one example of Scanner class. Here, how to calculate Simple Interest is displayed. Source code... package oop; import java.util.Scanner; public class ScannerDemo { // Scanner is a class, located inside java.util package // Scanner is used to take input from user in console public static void main(String[] args) { int t; double p, r; double si; Scanner in = new Scanner(System.in); System.out.println("Principle amount:"); p = in.nextDouble(); System.out.println("Enter rate:"); r = in.nextDouble(); System.o

Logical operator in JAVA

Image
 Logical operators are widely used in decision making in JAVA. The Operators are used to check the given condition or expression whether they are true or false. Mostly logical operators are used to check condition if there are two or more expression and whether the expressions(two or more expressions) are returning true or not. There are three logical operator i.e. AND Operator (&&), OR Operator (||) and NOT Operator (!). Lets see below example to explore it in more convenient way.  Let's suppose we are making console application based voting system. The criteria are defined below. 1)Must be citizen of some regulatory body, lets assume Nepal. At first he or she must have proof that he       or  she crossed 16 and has citizenship card. Then only the persoin is known as citizen.  1) Must have crossed age 18. (Age defined he or she is eligible for vote or not). 2) Must have Voting Card. If all the condition is satisfied then he or she is eligible to vote. Let's check this

Relational Operator in JAVA

 https://youtu.be/rSTNMxkBQgQ

Assignment Operator In JAVA

Image
This video depicts what is assignment operator and how to work with assignment operator. 

Arithmetic Operator in JAVA

 There are different types of operators in java programming language. one of them is arithmetic operator. Arithmetic operators are used to do arithmetic operations in java. The sign used on arithmetic operation are listed below. 1) Addition +  2) Subtraction - 3) Division / 4) Multiplication * 5) Modulo % ( It gives reminder after division) Example below displays the source code of performing arithmetic operation.  package operators; public class ArithmeticOperators { // basically there are 5 types of arithmetic operator // 1) addition + // 2) Subtraction - // 3) multiplication * // 4) division / // 5) modulo % public static void main(String[] args) { int a = 10; int b = 22; // lets do addition first System.out.println("Total sum = " + (a + b)); // subtraction System.out.println("b - a = " + (b - a)); // multiplication System.out.println("a * b = " + (a * b)); // division System.out.println("a / a = " +

Install JDK on your computer

Image
   Install JDK in your computer Learning java as a programming language is better for beginners. Java is very popular programming language in the world. It is simple to learn and it has many advantages. Java is object oriented programming language. Java code is, "write once and read many times" format. When any software is developed in java, it runs in any environment. It has features like platform independent, secure, multithreading, memory allocation and many more. In this blog, how to install Java Development Kit (JDK) in your windows machine is shown. Steps      1) go to your browser and type "download JDK" and hit enter.     2) Click on Download JDK and click on download according to your operating system.      3) Install JDK      4) Go to installation folder of JDK          > C drive, OS installed drive > program files > java > jdk-15.0.1 > bin          > copy the path      5) Right click on "This pc or My computer"     6) select pr

Tic Tac Toe Game in JAVA

Long time ago I read that learning programming is so fun, if you didn't find learning programming fun then you must not interested or your teacher don't know how to teach the programming. There is also written that the programming teacher must be working on industry so that he/she could be able to teach you the way how to overcome the programming obstacles. At the beginning phase of studying programming language, I used to worry about what if i couldn't able to write the code clearly and understandable. I always used to worry about it. But one day my facilitator said that now you are developing your career in software industry. Don't ever worry about the clear code. Just you do mistake as many times as it takes to get the task done. Then after the task is done, be clear what you did, what you learned from mistakes and what problem is solved. Then always make a habit of writing comment in the source code. There are a lot of things that he told us, these are few.  At