This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
package com.sample.code.java; | |
public class HelloWorld { | |
public static void main(String[] args) { | |
System.out.println("Hello World"); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public class IsRotation { | |
public static void main(String[] args) { | |
String a = "ABCD"; | |
String b = "DABC"; | |
System.out.println(isRotation(a,b)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Please follow below steps to use Java on Jupyter Notebook, to experiment Java code on browser and share snippets with others for trying out. | |
Please note that this is for windows environment. | |
1. Install Anaconda for Windows from https://www.anaconda.com/download/ | |
2. After installation of Anaconda, open Anaconda Navigator and install Jupyter Notebook | |
3. Download java kernel from https://github.com/SpencerPark/IJava/releases/download/v1.2.0/ijava-1.2.0.zip | |
4. Extract ijava-1.2.0.zip file |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
var arr = [], l = document.links; | |
for(var i=0; i<l.length; i++) { | |
arr.push(l[i].href); | |
} | |
for(var i=0; i<arr.length;i++){ | |
var str = arr[i]; | |
if(str.startsWith("https://www.youtube.com")){ | |
console.log(str); | |
} | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.io.BufferedReader; | |
import java.io.FileNotFoundException; | |
import java.io.FileReader; | |
import java.io.IOException; | |
/** | |
* Created by gansai on 12/11/15. | |
* Referred to http://stackoverflow.com/a/4716623 | |
*/ | |
public class ReadFile { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.*; | |
/** | |
* Created by gansai on 11/10/15. | |
*/ | |
public class FindPairSum_Sorted { | |
public static void main(String args[]) | |
{ | |
Integer array[] = new Integer[] { 1, 43, 2, 55, 21, 87, 9 }; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
/** | |
* Created by gansai on 11/10/15. | |
*/ | |
public class FindPairSum_Brute { | |
public static void main(String args[]) | |
{ | |
int array[] = new int[] { 1, 43, 2, 55, 21, 87, 9 }; | |
int sum = 76; | |
boolean foundPair = false; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#This is my first Ruby code | |
print "Hi Everyone. How are you?" | |
puts "Enter a value" | |
num = gets.to_i | |
puts "Enter another value" | |
num_2 = gets.to_i | |
puts num.to_s + " + " + num_2.to_s + " = " + (num + num_2).to_s |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import java.util.List; | |
import twitter4j.Status; | |
import twitter4j.Twitter; | |
import twitter4j.TwitterException; | |
import twitter4j.TwitterFactory; | |
import twitter4j.conf.ConfigurationBuilder; | |
public class TweetMain { | |
public static void main(String[] args) { |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
-module(hello). | |
%% API | |
-export([hello/0]). | |
hello() -> io:fwrite("Hi. This is my first Erlang Program.\n"). |
NewerOlder