Skip to main content
  • Facebook
  • Google
  • Dribble
  • Linkedin
  • Pinterest
  • RSS Feeds
Home

Techie Tet

  • Home
August 24
  • Posted By: pradeeshtet
  • Comments: 0

connect JSP with mysql in Linux

Let us make a simple application to connect and access mysql database from jsp code. This covers example jsp program to connect mysql, installing apache tomcat server, configuring mysql connector to establish jdbc driver, setting up the connection. 1st application using jsp.

To run a java server page in localhost, we need to setup a server.

Installing Latest Apache Tomcat server :

Run the following command in the terminal,

                         sudo apt-get install tomcat8            

  • Read more about connect JSP with mysql in Linux
  • pradeeshtet's blog
  • Comments
August 22
  • Posted By: pradeeshtet
  • Comments: 0

Find all occurrence of character in the string

Program to find index of particular character occur throughout the string.

Index tell where the character occur.

void Findindex(char c,int n)

{

int n=0;

int result;

String str=”roses”;

while(result>0)

{

result=str.indexOf(c,n);

System.out.println(result);

n=result+1;

}

}

invoking the method

p.Findindex('s',0);

output of the above program:

2

4

-1

Know how the indexOf method is used in java.

  • Read more about Find all occurrence of character in the string
  • pradeeshtet's blog
  • Comments
August 22
  • Posted By: pradeeshtet
  • Comments: 0

indexOf() method in java

Java string indexOf() with example program and explanation.

indexOf(char c)

It return index of first occurrence of a character in the string.

example:


String str="tet";

int result= str.indexOf('e');

Now, the value of result will be 1.

indexOf(char c, int fromindex)

Fromindex set the index from where the particular character is to be searched.

example:

  • Read more about indexOf() method in java
  • pradeeshtet's blog
  • Comments
August 22
  • Posted By: pradeeshtet
  • Comments: 0

Given a string of odd length, return length three from its middle- replaceALL

java replaceAll() method with example program. This kind of question are asked in codingbat. Improve your programming skills by solving this, its for beginners. Program with explanation.

public String middleThree(String str)

{

String newstr;

int mid;

str=str.replaceAll(“\\s” , “”);

int len=str.length();

if(len==3)

{

return str;

}

mid=(len/2)-1;

newstr=str.substring(mid,mid+3);

return newstr;

}

Below program explain java replace() method. Syntax, example and explanation.

  • Read more about Given a string of odd length, return length three from its middle- replaceALL
  • pradeeshtet's blog
  • Comments
August 22
  • Posted By: pradeeshtet
  • Comments: 0

Replace particular character with other in a String JAVA

simple java program to replace particular character in a string with other.

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

String st1=”TechieTet”;
String st2=st1.replace(‘e’,’x’);
System.out.println(st2);
}
}

Output of this program will be

  Txchix Txt

 

Syntax of replace method

    replace(char oldchar, char newchar)

   replace(string oldstr, string newstr)

Not only character also a part of string i.e substring can be changed using replace.

  • Read more about Replace particular character with other in a String JAVA
  • pradeeshtet's blog
  • Comments
August 21
  • Posted By: pradeeshtet
  • Comments: 0

Reverse the string Program in java

Simple program to reverse the string in java. This logic, also used to check whether the given string is palindrome or not. By comparing string after reversing it.

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

String reverse=” “;
String original=”Techie Tet”;
int len=original.length();
for(int i=len-1;i>=0;i--)
  {
reverse=reverse+original.charAt(i);
 }
System.out.println(reverse);

}
}

 

  • Read more about Reverse the string Program in java
  • pradeeshtet's blog
  • Comments
August 21
  • Posted By: pradeeshtet
  • Comments: 0

Program for Fibonacci series

Simple java program to display Fibonacci series using while loop with explanation.Its also called as fibonacci number or sequence. Know what is fibonacci number here.

class fibo {
    public static void main(String args[])  {
       int a=0,b=1,c;
       System.out.println(a);
      while(b<11) 
       {
                System.out.println(b);
  c=a+b;
a=b;
b=c;
}
}
}

Output:

0

1

1

2

3

5

8

  • Read more about Program for Fibonacci series
  • pradeeshtet's blog
  • Comments
August 21
  • Posted By: pradeeshtet
  • Comments: 0

Factorial using recursion program

Simple java program for factorial using recursion with explanation. Easy logic, can be used in C#(sharp), python, php, perl... etc.

int fact(int n)
{
int result;
if(n==1)
{
return 1;
}
result=fact(n-1)*n;
return result;
}

Understand the logic behind recursion, so you don’t feel factorial using recursion as difficult.

Input -5, Output – 120.

Explanation:

How to find factorial of number 5 using recursion.

Recursion – Function call itself.

Example 1:

  • Read more about Factorial using recursion program
  • pradeeshtet's blog
  • Comments
August 11
  • Posted By: pradeeshtet
  • Comments: 0

Even or Odd Program without using modules%

Let us see a java program finding even or odd without using modules operator. Frequent Interview question in technical or programming round. Programming languages  C#(sharp), python,php, c, c++,java.Even number is a number, which is divisible by two, rest of the numbers are odd numbers.

  • Read more about Even or Odd Program without using modules%
  • pradeeshtet's blog
  • Comments
August 7
  • Posted By: pradeeshtet
  • Comments: 0

Even or Odd java program

Check whether the given number is even or odd, use scanner to get input from user(Getting integer input from user). To get input from in java, Scanner class is used. Scanner class should be imported to use the funtionality(methods) of Scanner.

 

  • Read more about Even or Odd java program
  • pradeeshtet's blog
  • Comments

Pages

  • « first
  • ‹ previous
  • 1
  • 2
  • 3
  • 4
  • next ›
  • last »

Recent posts

  • Engineering college performance based on Pass percentage Tamilnadu
  • Anna University CGPA calculator
  • TamilNadu 12th public exam Result 2015- TN 12th Results
  • Insertion sort algorithm simple explanation with example
  • program to sort the string in alphabetical order in java
More

User login

  • Request new password

Like us

Related post

Check Your College Rank Here

--------------------------------------------

Aptitude test

--------------------------------------------

GPA and CGPA calculator

--------------------------------------------

Prepare for interview, take a mock test here

Popular content

Today's:

  • Program to reverse digits in a number
  • Find all occurrence of character in the string

All time:

  • fetch data from database using php/mysqli select query
  • GPA calculator Anna University
  • Anna University CGPA calculator
  • program to sort the string in alphabetical order in java

Last viewed:

  • Even or Odd Program without using modules%
  • string array with example program in c++

Some of Our Featured Projects

  • View Image

    BlackBerry Website Project

    Web
  • View Image

    Vestibulum ante ipsum primis

    Illustration
  • View Image

    Nulla mollis fermentum nunc

    Illustration
  • View Image

    Cras vel orci sapien

    Illustration / Web
  • View Image

    Curabitur nisl libero

    Illustration / Web
  • View Image

    BlackBerry Website Project

    Web
  • View Image

    Vestibulum ante ipsum primis

    Illustration
  • View Image

    Nulla mollis fermentum nunc

    Illustration
View full portofolio
↑
Powered by Techie Tet .