Skip to content

Instantly share code, notes, and snippets.

View isauravmanitripathi's full-sized avatar
🏁
1111

saurav tripathi isauravmanitripathi

🏁
1111
View GitHub Profile
public class Sum_Recursive {
private String sumString (final int n) {return "sum (" + n +")";}
private int max = 0;
private void printout (final int n, final String s) {
System.out.println( sumString(n));
for (int i = 0 ; i <= max - n; ++i) {System.out.print(" ");}
System.out.print(s);
}
private int sum(final int n) {
class Hello {
// other parts of the class
private void sayHello() {
System.out.println("Hello");
System.out.println("This is a method called sayHello");
System.out.println("It contains 3 statement");
}
public static void main(final String [] args) {
public class Hello {
// other parts of the class
...
private void sayHello() {
System.out.println("Hello");
System.out.println("This is a method called sayHello");
System.out.println("It contains 3 statement");
}
private void sayHello(){
System.out.println("Hello");
System.out.println("This is a method called sayHello");
System.out.println("It contains 3 statement");
}
// Account.java
// Account class with a constructor that initialize the name.
public class Account {
private String name; // instance variable
// constructor initializes name with parameter name
public Account(String name) { // constructor name is class name
this.name = name;
}
// AccountTest.java
// creating and manipulate an Account object.
import java.util.Scanner;
public class AccountTest {
public static void main(String[] args) {
// create a Scanner object to obtain input from the command window
Scanner input = new Scanner(System.in);
// create an Account object and assign it to myAccount
// account.java
// Account class that contains a name instance variable
// and methods to set and get its value.
public class account {
private String name; // instance variable
// method to set the name in the object
public void setName(String name);{
this.name = name; // store the name
<!DOCTYPE html>
<html>
<body>
<script>
$(document).ready(function () {
//wire up button click
$('#go').click(function () {
// test for presence of geolocation
if (navigator && navigator.geolocation) {
<!DOCTYPE html>
<html>
<body>
<script>
$(document).ready(function () {
//wire up button click
$('#go').click(function () {
// test for presence of geolocation
if (navigator && navigator.geolocation) {
// make the request for the user's position
@isauravmanitripathi
isauravmanitripathi / locate.php
Last active March 24, 2019 17:34
Help you to get location of your user in real time, in php
<h1>Getting your current location</h1>
<input type="button" id="go" value="click me to view your location">
<script>
$(document).ready(function () {
// wire up button click
$('#go').click(function() {
// test for presence of geolocation
if (navigator && navigator.geolocation) {
navigator.geolocation.getCurrentPosition(geo_success, geo_error);
} else {