Tuesday 5 June 2012

Backlink Widget

Do you want to make your bolg famous? This is a free, fast, and simple method to get traffic on your blog. By creating backlinks you can optimizing your blog or web page on search engines result.Here, we offer a backlink for free and very fast for your sites. Copy the html code first (no change needed), and then paste to your website or blog.To view your backlink you can click the image link from your website or blog. And well... your website url done and will be displaying in first references.If any visitors click this banner from your website or blog, your url backlink will be creating automatically in this website.You can build backlink as many as you want, no limitation and restriction, but no spam ! Wish your website's ranking quickly on Top Google, Yahoo and Alexa!

You can creat backlink in very simple:-
Go to your blog's dashboard-->layout-->add a gadget-->HTML/JavaScript
copy and  paste the following code into it..(no editing required)

<!-- Dont edit this code or it will not work --><a target="_blank" href="http://java2k.blogspot.com/" title="Free Backlinks"><img border="0" alt="Free Backlinks" src="https://blogger.googleusercontent.com/img/b/R29vZ2xl/AVvXsEiWcvFA9s75qF8AGdbkZG_r9fBSfVXcRkVRfw9H788ZkT8grsP0gENIs88yu55S1_DPkGwUfO5w50fy3ey1VkU7967vI4wtVRZcMtdqWprAGnssSS-4aYfVPTL7InLXBAq_EJTV-mrwTY2T/s1600/24works-backlinks.gif" /></a><!-- End http://java2k.blogspot.com-->

Monday 4 June 2012

Recursion in java

public class MyClass {
public static void main(String[] args) {
    System.out.println(fact(5));
   
}   

public static long fact(long n){
    if(n <= 1){
        return 1;
    }
    else{
        return n*fact(n-1);
    }
}

}

Output:
120

concat Method of String


public class MyClass {
public static void main(String[] args) {
    String str1 = "harry";
    String str2 = "jerry";
    System.out.println(str1.concat(str2));
}   
}
 Output:
harryjerry

indexOf Method of String

public class MyClass {public static void main(String[] args) {
    String str = "harryjerryharryjerryharry";
    System.out.println(str.indexOf('e'));
}   
}

Output:
6


The method str.indexOf('e') will return the index of letter e of first occurrence in the string


Another example:
public class MyClass {
public static void main(String[] args) {
    String str = "harryjerryharryjerryharry";
    System.out.println(str.indexOf("yj"));
}  
}
Output:
4

startsWith Method of String


public class MyClass {
    public static void main(String[] args) {
        String [] words = {"tom","jerry","tomato","potato"};
       
        for(String w:words){
            if(w.startsWith("to")){
                System.out.println(w+" starts with to");
            }
        }
    }
}


Output:
tom starts with to
tomato starts with to


Monday 19 September 2011

Esoteric programming language

An esoteric programming language (sometimes shortened to esolang) is a programming language designed as a test of the boundaries of computer programming language design, as a proof of concept, or as a joke. There is usually no intention of the language being adopted for mainstream programming, although some esoteric features such as visuospatial syntax have inspired practical applications in the arts. Such languages are often popular among hackers and hobbyists. This use of esoteric is meant to distinguish these languages from more popular programming languages.
Usability is rarely a high priority for such languages; often quite the opposite. The usual aim is to remove or replace conventional language features while still maintaining a language that is Turing-complete, or even one for which the computational class is unknown.

A sample program in java2k

FOR-1 07=119 TO-/12 4DO/*/_\/12 4=13 2=*+*.+_.\+119 =11 6=*+_.+13 2/*/_\..
16  /125 =119 =125 =11 6=*+_.+_.+125 /13 2/*/_\/_\.+125 /131 /119 /125 /11 6/*/_\/_\/
125 =13 2=*+_.+_.\/119 =125 =11 6=*+_.+_.+125 /13 2/*/_\/_\.\/131 =119 =125 =11 6=*+_
.+_.+125 /13 2/*/_\/_\.+131 /119 /125 /11 6/*/_\/_\/125 =13 2=*+_.+_.\/131 =119 =125 
=11 6=*+_.+_.+125 /13 2/*/_\/_\.+131 /119 /125 /11 6/*/_\/_\/125 =13 2=*+_.+_.\/131 =
119 =125 =11 6=*+_.+_.+125 /13 2/*/_\/_\.+119 /125 /11 6/*/_\/_\/125 =13 2=*+_.+_.\.\
.\.\./837=119 /12 4/*/_\/12 4=13 2=*+*.+_.\+119 /12 4/*/_\/12 4=13 2=*+*.+_.\.\
1 1 =*+837/119 /12 4/*/_\/12 4=13 2=*+*.+_.\/119 /12 4/*/_\/12 4=13 2=*+*.+_.\\.