Wednesday, 15 April 2015

Android Studio Temperature Conversion

Hi , Now I am moving towards new Program that is Android Studio Calculator , a very basic calculator which will look as below :


Temperature Converter Android Studio

This link has been moved to a new site here -----> Android Studio Temperature Conversion 
http://www.javainhouse.com/2016/01/android-studio-temperature-conversion.html
Read More »

Friday, 13 February 2015

WAP to find first Position of a String in another String


Hi , My today's post is on a program to find  Position of a String in another String.
For Example ,Given two strings, A and B, how to find the first position of B in A? For instance, A = " ab123cdefgcde"; B= "cde" Then the first position of B in A is 6.



import java.util.Scanner;




public class SB

{




 public static void main(String[] args) {
 
  {
   String test=null;
   String index=null;
   int j=0;
   System.out.println("Enter the string");
   test= new Scanner(System.in).nextLine();
   System.out.println("Enter the substring you want to count");
   index= new Scanner(System.in).nextLine();
   for (int i = 0; i <= test.length()-index.length(); i++) {
    String testing=test.substring(i, index.length()+i);
   
    if(testing.equals(index))
    {
    j=i+1;
    System.out.println("It occurs first  at "+ j +" position" );
    break;
    }
   }

  }
 }
}
   
Read More »

Saturday, 7 February 2015

Android Studio Calculator Example

Hi , Now I am moving towards new Program that is Android Studio Calculator , a very basic calculator which will look as below :


Calculator Example Android Studio

This link has been moved to new address

 http://www.javainhouse.com/2016/01/android-studio-calculator-example.html

Read More »

Thursday, 5 February 2015

Android Button Example

Hi Today's my post on How to use Button in Android .Button is a UI widget . If you are very beginner first go through my first example of Android Hello World which helps you how to run a very basic program in android.



Android Button Example


This link has been moved to new address  :  http://www.javainhouse.com/2016/01/button-example-android-studio.html

Read More »

Sunday, 1 February 2015

Hello World Android Studio

Hi, After installing Android Studio Let us see how to create our very first program Hello World

This link has been moved to a new site here -----> Hello World Android Studio


Step 8: Run 


Run this program and this will show you the output on emulator .I am using Nexus 7 as AVD .How to add a AVD in your studio you can see here.


Hello World Android Studio
Hello World Android
If you are facing some errors in running the above program you can refer below as I was also facing many errors so I have drafted them for your help .



Read More »

Android Studio Installation

Android Studio is the official IDE for Android application development, based on IntelliJ IDEA. On top of the capabilities you expect from IntelliJ, Android Studio offers:
  • Flexible Gradle-based build system
  • Build variants and multiple apk file generation
  • Code templates to help you build common app features
  • Rich layout editor with support for drag and drop theme editing
  • Lint tools to catch performance, usability, version compatibility, and other problems
  • ProGuard and app-signing capabilities
  • Built-in support for Google Cloud Platform, making it easy to integrate Google Cloud Messaging and App Engine

You can download Android Studio from the link below:

http://developer.android.com/sdk/index.html


 After downloading Android Studio keep on clicking next and install android studio .


You may like :
Android Studio Hello World Program

Android Button Example


Read More »

Tuesday, 27 January 2015

Program for Shifting characters in a String eg. String "abcde" should be printed as "eabcd"



import java.util.Scanner;

public class SB
{
public static void main(String []args) {

Scanner in = new Scanner(System.in);

         System.out.println("Enter a string to shift characters");
      String  test = in.nextLine();


 For further visit    Javainhouse
Read More »

Saturday, 24 January 2015

Find length of String without using any length or size method

import java.util.Scanner;


public class SB

{

public static void main(String[] args) {

{
String test;
      Scanner in = new Scanner(System.in);

     For further program please visit my new blog http://javainhouse.blogspot.com










Read More »

Print "welcome bangalore" as welcome erolagnab

import java.util.Scanner;


public class SB

{

public static void main(String[] args) {

{
String test="welcome bangalore";

String reverse="";


 int i=0;

 String a[]=test.split(" ");


 for (int j = a[1].length()-1; j >= 0; j--)
 {

reverse = reverse + a[1].charAt(j);
 }


 a[1]=reverse;
 test=a[0] +" "+ a[1];
 System.out.println(test);



}
}
}











Read More »

Thursday, 22 January 2015

Program in java to check whether a String is palindrome or not

import java.util.*;
public class Palindrome
{
   public static void main(String args[])
   {
      String original, reverse = "";
      Scanner in = new Scanner(System.in);
 
Program in java to check whether a String is palindrome or not       System.out.println("Enter a string to check palindrome");
      original = in.nextLine();
 
      int length = original.length();
 
      
     
      for ( int i = length - 1 ; i >= 0 ; i-- )
         reverse = reverse + original.charAt(i);
 
      if(reverse.equals(original))
      System.out.println("Yes String is palindrome");
      else
       System.out.println("NO String is not palindrome"); 
   }
}
Read More »