java.io.Console.<init>()方法的使用及代码示例

x33g5p2x  于2022-01-18 转载在 其他  
字(5.3k)|赞(0)|评价(0)|浏览(157)

本文整理了Java中java.io.Console.<init>()方法的一些代码示例,展示了Console.<init>()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。Console.<init>()方法的具体详情如下:
包路径:java.io.Console
类名称:Console
方法名:<init>

Console.<init>介绍

暂无

代码示例

代码示例来源:origin: robovm/robovm

private static Console makeConsole() {
  // We don't care about stderr, because this class only uses stdin and stdout.
  if (!Libcore.os.isatty(FileDescriptor.in) || !Libcore.os.isatty(FileDescriptor.out)) {
    return null;
  }
  try {
    return new Console(System.in, System.out);
  } catch (IOException ex) {
    throw new AssertionError(ex);
  }
}

代码示例来源:origin: stackoverflow.com

import groovy.ui.Console
public class TestGroovyConsole{
  public static void main(String[] args){
    int x = 5;
    Console console = new Console();
    console.setVariable("x",x);// to make x available in console
    console.run(); // to launch console
  }

}

代码示例来源:origin: stackoverflow.com

var Console = function () {
  this.log = function(msg){ debug(msg) }; 
};
var console = new Console();
console.log("hello");

代码示例来源:origin: stackoverflow.com

// (2) Returns same instance each time
class System {
 private static final Console CONSOLE = new Console();

 static Console console() {
  return CONSOLE;
 }
}

代码示例来源:origin: stackoverflow.com

// (1) Returns new instance each time
class System {
 static Console console() {
  return new Console();
 }
}

代码示例来源:origin: stackoverflow.com

function Console() {

 this.log = function(e) {
  document.getElementById("demo").innerHTML = e;
 }
}
var console = new Console();


console.log("Hello");

代码示例来源:origin: stackoverflow.com

public static void main(String[] args)throws InterruptedException {
  g = new Console();
  BallLoop();
}

代码示例来源:origin: stackoverflow.com

public Console console() {
  if (istty()) {
    if (cons == null)
      cons = new Console();
      return cons;
    }
  return null;
}

代码示例来源:origin: stackoverflow.com

Console c = new Console();
c.print("Input: ");
String input = c.getUserInput();
c.printLine("Entered text: " + input);

代码示例来源:origin: com.jtransc/jtransc-rt

private static Console makeConsole() {
  try {
    return new Console(System.in, System.out);
  } catch (IOException ex) {
    throw new AssertionError(ex);
  }
}

代码示例来源:origin: stackoverflow.com

using java.io.Console;

public class Words{

 public static void main(String[] args){
   Console con = new System.Console();
   System.out.println("Enter some text");
   String input = con.readLine();

 }

}

代码示例来源:origin: stackoverflow.com

HttpSession session = request.getSession();
Console service-option=null;
service-option=(Console)session.getAttribute("console");
if(service-option==null){
 service-option=new Console();
}
 // After doing your work(setting some variables etc)of Console Class Object 
 // you can set that Object in Session Like this

session.setAttribute("console", service-option); // here "console" is key

代码示例来源:origin: stackoverflow.com

try
{
 Console console = new Console();
 for(String input = console.readLine(); !"quit".equals(input); input = console.readLine())
 {
   // do stuff with input
 }
}
catch(IOException e)
{
 // handle e
}

代码示例来源:origin: stackoverflow.com

//This makes our console object which we can get input or write to, the class mentioned in the link must be in the same directory in Eclipse as this one
 try {
   Console console = new Console();
 }catch (IOException e) {}
 //Our input scanner we use console.piOut instead of System.in
 Scanner s = new Scanner(console.piOut);
 String sample = s.nextLine(); //Gets some input
 //Makes a printer where we can write to the console:
 PrintWriter printer = new PrintWriter(console.poOut);
 //Simple HelloWorld same usage as System.out.println() etc
 printer.println("Hello");
 printer.println("You said: " + sample);

代码示例来源:origin: ibinti/bugvm

private static Console makeConsole() {
  // We don't care about stderr, because this class only uses stdin and stdout.
  if (!Libcore.os.isatty(FileDescriptor.in) || !Libcore.os.isatty(FileDescriptor.out)) {
    return null;
  }
  try {
    return new Console(System.in, System.out);
  } catch (IOException ex) {
    throw new AssertionError(ex);
  }
}

代码示例来源:origin: MobiVM/robovm

private static Console makeConsole() {
  // We don't care about stderr, because this class only uses stdin and stdout.
  if (!Libcore.os.isatty(FileDescriptor.in) || !Libcore.os.isatty(FileDescriptor.out)) {
    return null;
  }
  try {
    return new Console(System.in, System.out);
  } catch (IOException ex) {
    throw new AssertionError(ex);
  }
}

代码示例来源:origin: com.mobidevelop.robovm/robovm-rt

private static Console makeConsole() {
  // We don't care about stderr, because this class only uses stdin and stdout.
  if (!Libcore.os.isatty(FileDescriptor.in) || !Libcore.os.isatty(FileDescriptor.out)) {
    return null;
  }
  try {
    return new Console(System.in, System.out);
  } catch (IOException ex) {
    throw new AssertionError(ex);
  }
}

代码示例来源:origin: com.gluonhq/robovm-rt

private static Console makeConsole() {
  // We don't care about stderr, because this class only uses stdin and stdout.
  if (!Libcore.os.isatty(FileDescriptor.in) || !Libcore.os.isatty(FileDescriptor.out)) {
    return null;
  }
  try {
    return new Console(System.in, System.out);
  } catch (IOException ex) {
    throw new AssertionError(ex);
  }
}

代码示例来源:origin: FlexoVM/flexovm

private static Console makeConsole() {
  // We don't care about stderr, because this class only uses stdin and stdout.
  if (!Libcore.os.isatty(FileDescriptor.in) || !Libcore.os.isatty(FileDescriptor.out)) {
    return null;
  }
  try {
    return new Console(System.in, System.out);
  } catch (IOException ex) {
    throw new AssertionError(ex);
  }
}

代码示例来源:origin: com.bugvm/bugvm-rt

private static Console makeConsole() {
  // We don't care about stderr, because this class only uses stdin and stdout.
  if (!Libcore.os.isatty(FileDescriptor.in) || !Libcore.os.isatty(FileDescriptor.out)) {
    return null;
  }
  try {
    return new Console(System.in, System.out);
  } catch (IOException ex) {
    throw new AssertionError(ex);
  }
}

相关文章