北京交通大学论坛-知行信息交流平台

 找回密码
 注册
快速进入版块与发帖 搜索
分享 路在脚下
study 2011-1-1 17:24
坎坎坷坷的道路,实际上看来是如此平凡。 我们生活在微分的世界里,看到的都是向上或向下的切线,同时我们感到的却是似乎永远没有多大变化的x 和x+dx。 其实生活就是这样,是否平坦,是否坎坷,只取决于我们的视角。 ...
个人分类: feeling|536 次阅读|0 个评论
分享 Java 数字格式化
study 2011-1-1 04:49
在C中可以使用类似printf(“%d %8.2f\\n”, 1001, 52.335)的方法实现格式化输出,可是Java中的System.out.println()并没有对应的功能。要格式化输出,必须使用java.text包中的类来实现类似的操作(要不怎么体现面向对象的优越性呢,不过据说jdk1.5准备又补上)。当然了,java.text包的功能还是很强大的,奇怪的是很多书中 ...
个人分类: Java|370 次阅读|0 个评论
分享 JAVA如何把一个float保留小数点后2位,以及多位
study 2011-1-1 04:41
四舍五入到小数点后2位 先转成String,再取其中几位,再转成float型,(如:String.valueOf(c).substring(0,String.valueOf(c).indexOf(".") + 3)): (一):这种方法方便,我就使用这种方法 float a = 123.2334f; float b = (float)(Math.round(a*100))/100; (这里的100就是2位小数点,如果要其它位,如4位, ...
个人分类: Java|595 次阅读|0 个评论
分享 Java数据类型转换
study 2011-1-1 04:15
基本数据类型转换的规则: Java中基本数据类型共有8种,其中boolean类型不能转换为其它类型,其它类型也不能转换为boolean型 除了boolean类型,还有7种,按照它们的容量(也就是表数范围,就是能表示的数的大小范围,比如char是0——65535)的大小,从小到大,排序依次为: byte short char int long float double 1.容量 ...
个人分类: Java|379 次阅读|0 个评论
分享 可能损失精度的问题-------原因分析
study 2011-1-1 03:51
在Java里面如果你写个1这样的 自然数 ,他默认是整型的。 如果你写个1.2这样的小数,他就默认是double型的。 如果你定义一个float n = 1.2;因为1.2默认是double类型的,你把 一个double类型的数赋值给一个float类型,是有可能损失精度的。 但是如果你在定义的时候这样 float n = 1.2f;这个后面的f就是 ...
个人分类: Java|506 次阅读|0 个评论
分享 instance variable
study 2011-1-1 03:04
In object-oriented programming with classes , an instance variable is a variable defined in a class (i.e. a member variable ), for which each object of the class has a separate copy. They live in memory for the life of the class. An instance variable is the opposite of c ...
个人分类: Java|479 次阅读|0 个评论
分享 java中判断字符串是否为数字的三种方法
study 2011-1-1 02:47
1用JAVA自带的函数 public static boolean isNumeric(Stringstr){ for ( int i = str.length(); --i=0; ){ if ( ! Character.isDigit(str.charAt(i))){ ...
个人分类: Java|367 次阅读|1 个评论
分享 Maple error---plot
study 2010-12-31 18:39
Warning: unable to evaluate the function to numeric values in the region; see the plotting command's help page to ensure the calling sequence is correct Error: empty plot Description This warning occurs when you create a Maple plot without ...
个人分类: Maple|738 次阅读|0 个评论
分享 有关java中toString()函数
study 2010-12-31 16:45
在 java 中,所有对象都有 toString() 这个方法,因为它是 Object 里面已经有了的方法,而所有类都是继承 Object ,所以 “ 所有对象都有这个方法 ” 它通常只是为了方便输出,比如 System.out.println(xx) ,括号里面的 “xx” 如果不是 String 类型的话,就自动调用 xx 的 toString() 方法 ...
个人分类: Java|386 次阅读|0 个评论
分享 Java笔记(四String和StringBuffer)
study 2010-12-31 16:04
在Java中,boolean、byte、short、int、long、char、float、double这八种是 基本数据类型 ,其余的都是引用类型,比如String、数组等 当我们声明一个引用类型变量时,系统只为该变量分配了引用空间,并未创建一个具体的对象;当用new为对象分配空间后,将对象的引用(内存中的首地址)赋值给引用变量 ...
个人分类: Java|376 次阅读|0 个评论

手机版|北京交通大学论坛-知行信息交流平台 ( BJTUICP备13011901号 )

GMT+8, 2023-6-2 17:30

Powered by Discuz! X3.4

Copyright © 2001-2020, Tencent Cloud.

返回顶部