switch input method in android code example

Example 1: how to input in java

import java.util.Scanner;
...
  Scanner console = new Scanner(System.in);
  int num = console.nextInt();
  console.nextLine() // to take in the enter after the nextInt() 
  String str = console.nextLine();

Example 2: how to change input value in javascript using class

// Find the input element with a class of "bar" that is a direct child of a form with a name attribute of "foo"
document.querySelector("form[name='foo'] > input.bar").value = "hehe works"

Tags:

Java Example