Skip to main content

Posts

VLOOKUP in MS Excel

VLOOKUP in MS Excel H ello and welcome back to Learn Java. It's been very long since I wrote my last post. This post will give you a short and simple tutorial on using VLOOKUP in MS Excel. Verticle Lookup or VLOOKUP is a function in MS Excel that helps a user look for a specific value in a column   based on another particular value in the first column. A simple example: Your boss asks you to find the price of a food item based on its name. Syntax: VLOOKUP(the value you want to look up, where you want to look for it(array/column/table), the column number the value is in, return an approximate or exact match) Let's try to understand it more clearly: Here's a little data set containing a table of my favourite food items.  Step 1: Select a specific cell/text value you would like to search for in the given table/data set. Here, we are looking for the price of Pizza, so we use cell value "Pizza" which is also cell reference A3. We are making sure to use a cell value/re
Recent posts

How to Use PRINT Statement in SAS (Step-by-Step Tutorial)

 Hello and welcome back to Learn Java! It's been a pretty long time since my last post. This post will give you a short and simple tutorial on how to use a PRINT statement in SAS. PRINT is a procedure in SAS(previously known as Statistical Analysis System). PRINT procedure is used to display the contents of the data sets in a readable tabular form with well organized rows and column. In SAS, rows are also known as variables, and columns are also referred to as observations. Let's see how to use PRINT in SAS: Step #1. Open your data set in SAS Studio. Step#2. Open your data set. Step #3. Open a new SAS Program. Step #4. Write the following code in your SAS Studio: data MaleFemale; infile '<path of your data set file>'; input Gender $ Age Height Weight; run; proc PRINT data=MaleFemale; run; Step #5. Click Run button. Step #6. Under RESULTS tab, you will see your data set in a well readable tabular form. I hope you found this post useful and interesting. For more u

Java Program To Check Whether a Number is Palindrome or Not

Welcome back to my blog! In this post, you will learn how to check whether a number is a palindrome or not in Java. A number is called palindrome if reads same when reversed. For example: 121, 111, 98789, etc. So let's get started! Algorithm: Enter the number which has to be checked. Assign the number to a temporary variable. Reverse the number. Compare the temporary number with the reversed number.  If both are same, print a message "The number is palindrome!" Else print "The number is not palindrome." Given below is the code to check whether the number is palindrome or not: class Palindrome { public static void main(String[] args) {      int rev, temp, sum = 0 ;      int n = 121 ; // The number to be checked whether it is palindrome or not.      temp = n;                  while (n > 0 ) {                     r = n% 10 ; // Getting the remainder                     sum = (sum * 10 ) + r;                       n = n/ 10 ;          

Fibonacci Series in Java

W elcome back to my blog! Today I will show you how to print a Fibonacci series in Java. Fibonacci series is a series of numbers where an addition of two numbers produces the next number. That next number is added to its previous number and again produces a next number and so on... The first two numbers of Fibonacci series are 0 and 1. Now let's see how to write the code for this: public class Series { public static void main(String args [])  {    int n1  = 0,  n2  = 1,  n3 ,  i ,  count  = 10;    System. out .println(n1+ " " +n2);      //printing 0 and 1       for(i=2; i<count; i++)      //loop starts from 2 because 0 and 1 are already printed     {      n3 =  n1 +  n2 ;      System. out .println( " " + n3 );      n1  =  n2 ;      n2  =  n3 ;    }    }         } It will produce the following output: 0 1 1 2 3 5 8 13 21 34 T hank you for coming to my blog. If you find this post useful, please share it wi

Inheritance in Java

W elcome back to my blog! In this post, you will learn about Inheritance in Java. Basically, Inheritance in Java is like a parent-child relationship. The child class acquires all the properties of the parent class. You can create new classes that are built upon existing classes. When you inherit from an existing class, you can reuse methods and fields of the parent class. You can also add new methods and fields. Why Inheritance is used:  For method over-riding,  To reuse code. Syntax: class subclass-name extends superclass-name { //methods and fields } Here, the keyword "extends" is used to derive all the properties from the superclass, i.e, the parent class. Types of Inheritance in Java: 1. Single Inheritance, 2. Multilevel Inheritance, 3. Hierarchical Inheritance, 4. Multiple Inheritance, 5. Hybrid Inheritance. 1. Single Inheritance:     In single inheritance, a child class extends its parent class.

Multi-threading using thread in Java

W elcome back to my blog! In my last post, you learned about control statements in Java. In this post, you will learn about multi-threading using thread in Java. Just follow the steps given below: So let's get started! Step #1: Open Eclipse and select the directory where you want to save your work. Step #2: Go to File>New>Project. Step #3: Select Java Project, then click Next.. Step #4: Give the name of your project and click on Finish. Step #5: You will see a source folder named "src". Add a new class by right-clicking on the source folder>New>Class. Step #6: You will see a screen like this: Write the following code: class Multi_thread extends Thread { public void run() { System.out.println("My thread is running...");    public static void main(String args[]) { Multi_thread obj = new Multi_thread(); obj.start(); }     } } Step #7: Click on the Run button to run your program. C ongratulations!!! You have learned multi-threading using thread in

Control Statements in Java (Part 2)

W elcome back to my blog!!! In my previous post you learned about if , nested ifs and else-if-else in Java. In this post you will learn about switch . What is a switch? In Java, a switch is a multiway branch statement. General form of a switch: switch(expression) { case value1: statement;                      break; case value2: statement;                      break; . . . . . . default: statement;               break; } The expression must be the type of int , byte , short or char . Duplicate case values are not allowed. The switch  statement works like this: the value of the expression is compared with each of the literal values in the case statements. If a match is found, the code sequence following the case statement is executed. If none of the constants matches the value of the expressions, then the default statement is executed. however, the default statement is optional. If no case matches and no default is present, then no further action is taken. The break statement i