console java

控制台类writer()方法 (Console Class writer() method)

  • writer() method is available in java.io package.

    writer()方法在java.io包中可用。

  • writer() method is used to get a distinct PrintWriter object linked with this Console.

    writer()方法用于获取与此控制台链接的独特PrintWriter对象。

  • writer() method is a non-static method, it is accessible with the class object only and if we try to access the method with the class name then we will get an error.

    writer()方法是一种非静态方法,只能通过类对象访问,如果尝试使用类名称访问该方法,则会收到错误消息。

  • writer() method does not throw an exception at the time of returning associated PrintWriter.

    返回关联的PrintWriter时, writer()方法不会引发异常。

Syntax:

句法:

    public PrintWriter writer();

Parameter(s):

参数:

  • It does not accept any parameter.

    它不接受任何参数。

Return value:

返回值:

The return type of the method is PrintWriter, it gets PrintWriter object linked with this Console.

该方法的返回类型为PrintWriter ,它获取与此控制台链接的PrintWriter对象。

Example:

例:

// Java program to demonstrate the example
// of PrintWriter writer() method of Console
import java.io.*;
public class WriterOfConsole {public static void main(String[] args) {try {// Instantiates Console , PrintWriter
// object
Console con = System.console();
PrintWriter pw = con.writer();
// Display by using PrintWriter
// object pw
pw.println("con.writer(): " + "Java Programming!!!");
} catch (Exception ex) {System.out.println(ex.toString());
}
}
}

Output

输出量

con.writer(): Java Programming!!!

翻译自: https://www.includehelp.com/java/console-writer-method-with-example.aspx

console java

console java_Java Console writer()方法与示例相关推荐

  1. drawimage的用法 java_Java Graphics.drawImage方法代码示例

    本文整理汇总了Java中javax.microedition.lcdui.Graphics.drawImage方法的典型用法代码示例.如果您正苦于以下问题:Java Graphics.drawImag ...

  2. console java_Java Console format()方法与示例

    console java 控制台类format()方法 (Console Class format() method) format() method is available in java.io ...

  3. setresult()java_Java ResultSet getType()方法与示例

    该java.sql.ResultSet中的接口表示由SQL语句返回这样的表格数据. 即ResultSet对象保存由执行查询数据库的语句的方法返回的表格数据(通常是Statement接口的execute ...

  4. setlength java_Java StringBuilder setLength()方法与示例

    StringBuilder类setLength()方法setLength()方法在java.lang包中可用. setLength()方法用于在将字符序列替换为新字符序列时设置字符序列的长度,因此该序 ...

  5. containskey java_Java Hashtable containsKey()方法与示例

    哈希表类containsKey()方法containsKey()方法在java.util包中可用. containsKey()方法用于检查给定对象是否为键元素(key_ele). containsKe ...

  6. findclass java_Java Context.findClass方法代码示例

    import jdk.nashorn.internal.runtime.Context; //导入方法依赖的package包/类 private static Class> simpleType ...

  7. Bytes int java_Java Bytes.readInt方法代码示例

    import net.openhft.chronicle.bytes.Bytes; //导入方法依赖的package包/类 @NotNull @Override public CharSequence ...

  8. object getkey java_Java S3Object.getKey方法代码示例

    import com.amazonaws.services.s3.model.S3Object; //导入方法依赖的package包/类 private S3Object decipher(GetOb ...

  9. fileset java_Java FileSet.iterator方法代码示例

    import org.apache.tools.ant.types.FileSet; //导入方法依赖的package包/类 public void execute() throws BuildExc ...

最新文章

  1. windows2012挂linux盘阵,磁盘阵(IPSAN)挂载Windows和Linux测试过程.doc
  2. hadoopHA自动切换不成功的坑
  3. 基于IdentityServer的系统对接微信公众号
  4. mysql忽略表名大小写_Mysql 表名忽略大小写-连接字符集随笔记录
  5. WPF 动画执行后属性无法修改
  6. MikroTik RB750r2/RB750gr3 操作记录
  7. matlab 使用.m文件,matlab 编写M文件(函数)
  8. Going Deeper into Regression Analysis with Assumptions, Plots Solutions
  9. uniapp打包app 踩坑记录
  10. 华为ar系列交换机虚拟服务器,交换机路由器虚拟服务器设置
  11. 算法(algorithm) 技能树测评
  12. 夜深人静写算法(三十七)- 威尔逊定理
  13. squid完全攻略 squid优化后详细安装步骤
  14. docker volume用法
  15. httpd.conf linux,linux上安装apache以及httpd.conf基本配置
  16. 人工智能一些基础知识
  17. linux su无效_Linux下su命令无反应的解决办法
  18. 三维图像专业处理软件Dragonfly 应用-如何计算面孔隙率
  19. 深度原创丨当互联网巨头从云端“抄底” BI 和大数据...
  20. 使用VBA在Office中输入特殊字符(1/3)

热门文章

  1. 面试提问vue中v-if与v-show的区别以及使用场景
  2. linux弹性网卡,将弹性网卡附加到 ECS 实例上之后如何配置弹性网卡
  3. js和css实现手机横竖屏预览思路整理
  4. 页面体验提升小技巧—渐进式图片
  5. centos7.3 docker安装grafana
  6. vue 图片资源应该如何存放并引入(public、assets)?
  7. 上传图片或文件 方法一
  8. 他人的一些2017年度总结
  9. Jmeter参数化 CSV Data Set Config界面说明
  10. 如何从 Datagrid 中获得单元格的内容与 使用值转换器进行绑定数据的转换IValueConverter...