Android Letx Code App

Letx code Android App.

I have successfully Develop my Youtube Channel android app.Now you can access all my youtube videos easily and directly in your mobile devices.So Download this in below given link and install this in your android mobile.

http://www.mediafire.com/file/p770ou027u82bn8/Letx_Code_1.0.rar

Using Scanner Class in java & Getting a character

Getting an  input from the user using Scanner class     in java:

      In this tutorial we are gonna see how to accept input from user. We are using Scanner class to get the input. In the below example we are getting input String, integer and a float number. For this we are using following methods:


  1. public String nextLine(): For getting input String
  2. public int nextInt(): For integer input
  3. public float nextFloat(): For float input





Main Class:

import java.util.Scanner;

public class Test
{
 public static void main(String args[])
 {
  int No;
  
  Scanner input = new Scanner(System.in);
  
  System.out.print("\nEnter a Number: ");
  No = input.nextInt();
  
  System.out.println("Entered Number is: " + No);
 }
}

  Getting a Single character from User in java:

   In java we get a String input from the user.For string nextLine() or only next() methods are used.But if we want to get only a character from the user.Then there is some other process for that.
We know that a string is an array of character.So in the case of character first we Convert the string to character array by using toCharArray() method.Then we pick the value at "0" index in char array.So this is our character which we get from the user. 


Main Class:

import java.util.Scanner;

public class Test
{
 public static void main(String args[])
 {
  String ss = "";
  
  Scanner input = new Scanner(System.in);
  
  System.out.print("\nEnter a Character: ");
  ss = input.nextLine();
         char[] arr = ss.toCharArray();
                char ch = arr[0];
  System.out.println("Character is: " +ch);
 }
}

Using Method Overloading in java

Method Overloading is a feature that allows a class to have two or more methods having same name, if their argument lists are different. In the last tutorial we discussed constructor overloading that allows a class to have more than one constructors having different argument lists.

Example of Method Overloading 

Main Class:

public class Test {

    /**
     * @param args the command line arguments
     */
    public static void main(String[] args) {
        // TODO code application logic here
        OverLoading obj = new OverLoading();
        obj.calcualte(3,4,"Letx code");
    }
  }
Define OverLoading Class:
public class OverLoading {
    public void calcualte(){
        System.out.print("No parameters!!");
    }
    public void calcualte(int a){
        System.out.print("Sum is: "+a+2);
    }
    public void calcualte(int a,String ch){
        System.out.print("Number is:"+a);
        System.out.print("Character is:"+ch);
    }
    public void calcualte(int a,int b,String ch){
        System.out.print("Product is:"+(a*b));
        System.out.print("String is:"+ch);
    }
}

Using Stack Structure in java


Stack in Java using array without stack class.


Java provides an inbuilt object type called Stack. It is a collection that is based on the last in first out (LIFO) principle. On Creation, a stack is empty.but I'm creating stack in this video manually without using stack class. 
There is also so many built methods for set elements in stack and also retrieve element from the stack.In this lecture I'm defining my own pop() & push() methods for storing and retrieving elements from the stack. 
1. push() Method : Pushes an element on the top of the stack.

2. pop() Method : Removes and returns the top element of the stack.

3. Over Flow : Pushes element when stack is already completely fill.Then Overflow Exception is occur.

4. Under Flow : This shows when all elements are pop from the stack.then the stack is empty,so if we again pop the stack then Under flow is occur in program.