首页
学习
活动
专区
工具
TVP
发布
精选内容/技术社群/优惠产品,尽在小程序
立即前往

在使用NumberFormat时,如何在Eclipse控制台中显示£符号?

在使用NumberFormat时,可以通过以下步骤在Eclipse控制台中显示£符号:

  1. 导入java.text包中的NumberFormat类:import java.text.NumberFormat;
  2. 创建一个NumberFormat对象:NumberFormat nf = NumberFormat.getCurrencyInstance();
  3. 设置货币符号为£:nf.setCurrency(Currency.getInstance("GBP"));
  4. 格式化数字并将其打印到控制台:System.out.println(nf.format(1234.56));

完整的代码示例如下:

代码语言:txt
复制
import java.text.NumberFormat;
import java.util.Currency;

public class Main {
    public static void main(String[] args) {
        NumberFormat nf = NumberFormat.getCurrencyInstance();
        nf.setCurrency(Currency.getInstance("GBP"));
        System.out.println(nf.format(1234.56));
    }
}

运行以上代码,控制台将显示£符号作为货币符号,输出结果为£1,234.56。

腾讯云相关产品和产品介绍链接地址: 腾讯云提供了丰富的云计算产品和服务,包括云服务器、云数据库、云存储、人工智能等。以下是一些相关产品和介绍链接地址:

  1. 云服务器(CVM):提供弹性计算能力,支持多种操作系统和实例类型。详情请参考腾讯云云服务器
  2. 云数据库MySQL版(CDB):提供高性能、可扩展的MySQL数据库服务。详情请参考腾讯云云数据库MySQL版
  3. 云对象存储(COS):提供安全、稳定、低成本的对象存储服务。详情请参考腾讯云云对象存储
  4. 人工智能平台(AI Lab):提供丰富的人工智能算法和模型,支持图像识别、语音识别、自然语言处理等应用场景。详情请参考腾讯云人工智能平台

请注意,以上链接仅供参考,具体产品选择应根据实际需求进行评估和决策。

页面内容是否对你有帮助?
有帮助
没帮助

相关·内容

通过写Java代码来对MyEclipse进行注册

import java.io.BufferedReader; import java.io.IOException; import java.io.InputStreamReader; public class MyEclipseGen { private static final String LL = "Decompiling this copyrighted software is a violation of both your license agreement and the Digital Millenium Copyright Act of 1998 (http://www.loc.gov/copyright/legislation/dmca.pdf). Under section 1204 of the DMCA, penalties range up to a $500,000 fine or up to five years imprisonment for a first offense. Think about it; pay for a license, avoid prosecution, and feel better about yourself."; public String getSerial(String userId, String licenseNum) {    java.util.Calendar cal = java.util.Calendar.getInstance();    cal.add(1, 3);    cal.add(6, -1);    java.text.NumberFormat nf = new java.text.DecimalFormat("000");    licenseNum = nf.format(Integer.valueOf(licenseNum));    String verTime = new StringBuilder("-").append(      new java.text.SimpleDateFormat("yyMMdd").format(cal.getTime()))      .append("0").toString();    String type = "YE3MP-";    String need = new StringBuilder(userId.substring(0, 1)).append(type)      .append("300").append(licenseNum).append(verTime).toString();    String dx = new StringBuilder(need).append(LL).append(userId)      .toString();    int suf = this.decode(dx);    String code = new StringBuilder(need).append(String.valueOf(suf))      .toString();    return this.change(code); } private int decode(String s) {    int i;    char[] ac;    int j;    int k;    i = 0;    ac = s.toCharArray();    j = 0;    k = ac.length;    while (j < k) {     i = (31 * i) + ac[j];     j++;    }    return Math.abs(i); } private String change(String s) {    byte[] abyte0;    char[] ac;    int i;    int k;    int j;    abyte0 = s.getBytes();    ac = new char[s.length()];    i = 0;    k = abyte0.length;    while (i < k) {     j = abyte0[i];     if ((j >= 48) &&

04

Ecplise的使用练习

----------------------------------------------------------------------------- Eclipse的概述和使用(掌握) 0:开发java的IDE的分类     免费的当中使用最多的是:Eclipse(Oracle公司的产品,位于美国加州红木城的红木岸)     收费的当中使用最多的是:IntelliJ IDEA(JetBrains(杰特Brains)公司的产品,位于东欧捷克的布拉格)       Kotlin(科特林) 1:Eclipse是一种可扩展的开放源代码的IDE(Integrated Development Environment集成开发环境)。     始于1999年4月,由OTI和IBM两家公司的IDE产品开发组组建。     2001年11月,IBM公司捐出价值4000万美元的源代码组建了Eclipse联盟,并由该联盟负责这种工具的后续开发。     最初主要用于Java语言开发,通过安装不同的插件,Eclipse可以支持不同的计算机语言开发。

01

Win7下Eclipse开发hadoop应用程序环境搭建

在Linux下使用安装Eclipse来进行hadoop应用开发,但是大部分Java程序员对linux系统不是那么熟悉,所以需要在windows下开发hadoop程序,经过试验,总结了如何在windows下使用Eclipse来开发hadoop程序代码。 1、需要下载hadoop的专门插件jar包   hadoop版本为2.3.0,hadoop集群搭建在centos6x上面,把插件包下载后,jar包名字为hadoop-eclipse-plugin-2.3.0,可以适用于hadoop2x系列软件版本。 2、把插件包放到eclipse/plugins目录下   为了以后方便,我这里把尽可能多的jar包都放进来了。 3、重启eclipse,配置Hadoopinstallationdirectory   如果插件安装成功,打开Windows—Preferences后,在窗口左侧会有HadoopMap/Reduce选项,点击此选项,在窗口右侧设置Hadoop安装路径。  4、配置Map/ReduceLocations   打开Windows-->OpenPerspective-->Other   选择Map/Reduce,点击OK,在右下方看到有个Map/ReduceLocations的图标,点击Map/ReduceLocation选项卡,点击右边小象图标,打开HadoopLocation配置窗口:输入LocationName,任意名称即可.配置Map/ReduceMaster和DFSMastrer,Host和Port配置成与core-site.xml的设置一致即可。   去找core-site.xml配置:   fs.default.namehdfs://name01:9000   点击"Finish"按钮,关闭窗口。点击左侧的DFSLocations—>myhadoop(上一步配置的locationname),如能看到user,表示安装成功,但是进去看到报错信息:Error:Permissiondenied:user=root,access=READ_EXECUTE,inode="/tmp";hadoop:supergroup:drwx---------。 应该是权限问题:把/tmp/目录下面所有的关于hadoop的文件夹设置成hadoop用户所有然后分配授予777权限。   cd/tmp/   chmod777/tmp/   chown-Rhadoop.hadoop/tmp/hsperfdata_root   之后重新连接打开DFSLocations就显示正常了。   Map/ReduceMaster(此处为Hadoop集群的Map/Reduce地址,应该和mapred-site.xml中的mapred.job.tracker设置相同)   (1):点击报错:   Aninternalerroroccurredduring:"ConnectingtoDFShadoopname01".   java.net.UnknownHostException:name01   直接在hostname那一栏里面设置ip地址为:192.168.52.128,即可,这样就正常打开了,如下图所示:   5、新建WordCount项目   File—>Project,选择Map/ReduceProject,输入项目名称WordCount等。   在WordCount项目里新建class,名称为WordCount,报错代码如下:InvalidHadoopRuntimespecified;pleaseclick'ConfigureHadoopinstalldirectory'orfillinlibrarylocationinputfield,报错原因是目录选择不对,不能选择在跟目录E:\hadoop下,换成E:\u\hadoop\就可以了,如下所示:   一路下一步过去,点击Finished按钮,完成工程创建,Eclipse控制台下面出现如下信息:   14-12-9下午04时03分10秒:EclipseisrunninginaJRE,butaJDKisrequired   SomeMavenpluginsmaynotworkwhenimportingprojectsorupdatingsourcefolders.   14-12-9下午04时03分13秒:Refreshing[/WordCount/pom.xml]   14-12-9下午04时03分14秒:Refreshing[/WordCount/pom.xml]   14-12-9下午04时03分14秒:Refreshing[/WordCount/pom.xml]   14-12-9下午04时03分14秒:Updatingindexcentral|http://repo1.maven.o

08
领券