首页 > 代码库 > Java和C#基本类库的区别

Java和C#基本类库的区别

java.lang

java

.net

Boolean

System.Boolean

Byte

System. Byte

Character

System.Char

Class

System.Type

Double

System.Double

Float

System.Single

Integer

System.Int32

Long

System.Int64

Math

System.Math

Object

System.Object

Process

System. Diagnostics .Process

Runtime

System. Diagnostics .Process

Short

System.Int16

StrictMath

System.Math

Strng

System.Strng

StringBuffer

System. Text .StringBuffer

Thread

System. Threading .Thread

ThreadLocal

System.LocalDataStoreSlot

java.lang.reflect

java

.net

AccessibleObject

System.reflection.MemberInfo

Array

System. Array

Constructor

System.reflection.ConstructorInfo

Field

System.reflection.FieldInfo

Method

System.reflection.MethodInfo

Modifier

System.reflection.MethodAttributes

ReflectdPermission

System. Security . Permissions.ReflectdPermission

java.lang.ref

java

.net

WeakReference

System.WeakReference

 

java.util包

java.util

java

.net

AbstractColletion

System.Collections.CollectionsBase

ArrayList

System.Collections.ArrayList

Arrays

System.Arrays

BitSet

System.Collections.BitArray

Calendar

System.Globalization.Calendar

Currency

System.Globalization.RegionInfo

Date

System.Datetime

Dictionary

System.Collections.DictionaryBase

EventObject

System.EventArgs

GregorianCalendar

System.Globalization.GregorianCalendar

HashMap

System.Collections.HashMap

Hashtable

System.Collections.HashMap

ListResourseBundle

System.Resources.ResourceManger

Locale

System.Globalization.CultureInfo

Random

System.Random

ResourseBundle

System.Resources.ResourceSet

SimpleTimeZone

System.Datetime

Stack

System.Collections.Stack

Timer

System.Threading.Timer

TimerTask

System.Threading.TimerCallback

TimeZone

System.DataTime

TreeSet

System.Collections.SortedList

Vector

System.Collections.ArrayList

java.util.regex

java

.net

Matcher

System.Text.RegularExpressions.Match

System.Text.RegularExpressions.MatchCollection

System.Text.RegularExpressions.Group

System.Text.RegularExpressions.GroupCollection

Pattern

System.Text.RegularExpressions.Regex

System.Text.RegularExpressions.RegexCompilationInfo

System.Text.RegularExpressions.RegexOption

PatternSyntaxExcetpion

System. ArgumentExcetion

 

java.util.logging/java.util.jar/java.util.zip/java.util.pref 包中的类在.NET中没有与之对应的部分

 

java.io包

java

.net

BufferedInputStream

System.IO.BufferedStream

BufferedOutputStream

System.IO.BufferedStream

BufferedReader

System.IO.StreamReader

BufferedWriter

System.IO.StreamWriter

ByteArrayInputStream

System.IO.MemoryStream

ByteArrayOutputStream

System.IO.MemoryStream

CharArrayReader

System.IO.StreamReader

CharArrayWriter

System.IO.StreamWriter

DataInputStream

System.IO.BinaryReader

DataOutputStream

System.IO.BinaryWriter

File

System.IO.File

FileInputStream

System.IO.FileStream

FileOutputStream

System.IO.FileStream

FileReader

System.IO.StreamReader

FileWriter

System.IO.StreamWriter

InputStream

System.IO.Stream

OutputStream

System.IO.Stream

PrintStream

System.IO.StreamWriter

PrintWriter

System.IO.StreamWriter

PushbackInputStream

System.IO.StreamReader

PushbackOutputStream

System.IO.StreamReader

RamdomAccessFile

System.IO.FileStream

StringBufferInputstream

System.IO.StringReader

StringReader

System.IO.StringReader

StringWriter

System.IO.StringWriter

 

java.sql包

.net 中没有与javax.sql包直接对应的部分,System.Data命名空间提供了连接池和事务处理类。

java的Rowset类在某些方面与.net的DataDet类相似

java

.net

Blob

System.Data.Sqlclient.SqlDataReader

System.Data.OleDb.OleDbDataReader

CallableStatement

System.Data.Sqlclient.Sqlcommand

System.Data.OleDb.OleDbcommand

Clob

System.Data.Sqlclient.SqlDataReader

System.Data.OleDb.OleDbDataReader

Connection

System.Data.Sqlclient.Sql

System.Data.OleDb.OleDb

Date

System.Data. SqlTypes . SqlDateTime

ParameterMetaData

System.Data.Sqlclient.SqlParameter

System.Data.OleDb.OleDbParameter

PreparedStatement

System.Data.Sqlclient.SqlCommand

System.Data.OleDb.OleDbCommand

ResultSet

System.Data.Sqlclient.SqlDataReader

System.Data.OleDb.OleDbDataReader

ResultSetMetaData

System.Data.Sqlclient.SqlDataReader

System.Data.OleDb.OleDbDataReader

Savepoint

System.Data.Sqlclient. SqlTransaction

SQLPermission

System.Data.Sqlclient.SqlclientPermission

System.Data.OleDb.OleDbPermission

Statement

System.Data.Sqlclient.SqlParameter

System.Data.OleDb.OleDbCommand

Time

System.Data. SqlTypes . SqlDateTime

Types

System.Data.DbTypes

 

java.text包

java

.net

DataFormat

System.DateTime

DateFomatSymbols

System.Globalization.DateaTimeFormatInfo

NumberFormat

System.Globalization.NumberFormatInfo

SimpleDateFormat

System.Globalization.DateTimeFormatInfo

StringCharacterIterator

System.IEnumerator (System,String)

 

org.w3c.dom包

java

.net

Attr

System.Xml.XmlAttribute

CdatSection

System.Xml.XmlCDataSetion

CharacterData

System.Xml.XmlCharacterData

Comment

System.Xml.XmlComment

Document

System.Xml.XmlDocument

DocumentFragment

System.Xml.XmlDocumentFragment

DocumentType

System.Xml.XmlDocumentType

DOMImplementation

System.Xml.XmlDOMImplementation

Element

System.Xml.XmlElement

Entity

System.Xml.XmlEntity

EntityReference

System.Xml.XmlEntityReference

NameNodeMap

System.Xml.XmlNameNodeMap

Node

System.Xml.XmlNode

NodeList

System.Xml.XmlNodeList

Notation

System.Xml.XmlNotation

ProcessingInstruction

System.Xml.XmlProcessingInstruction

DOMException

System.ArgumentException

 

javax.swing包

.net没有提供与下列包直接等价的类:

javax.swing.plaf/javax.swing.border/javax.swing.table/javax.swing.text( 可用System.Windows.Form.RichTextBox 代替 ) 和 javax.swing.filechooser ( 可用System.Windows.Form.OpenFileDialog 和 System.Windows.Form.SaveFileDialog 代替 )

javax.swing

java

.net

AbstractButton

System.Windows.Forms. ButtonBase

AbstractListModel

System.Windows.Forms.ListControl

AbstractSpinnerModel

System.Windows.Forms.UpDownBase

ImageIcon

System.Windows.Forms.Image

Jbutton

System.Windows.Forms.Button

JCheckBox

System.Windows.Forms.CheckBox

JColorChooser

System.Windows.Forms.ColorDialog

JComboBox

System.Windows.Forms.ComboBox

JComponent

System.Windows.Forms.UserControl

JDialog

System.Windows.Forms.CommonDialog

JEditorpane

System.Windows.Forms.TextBoxBase

JFileChooser

System.Windows.Forms.OpenFileDialog

JFormattedTextField

System.Windows.Forms.RichTextBox

JFrame

System.Windows.Forms.Form

JLabel

System.Windows.Forms.Label

JList

System.Windows.Forms.ListBox

JMenuBar

System.Windows.Forms.MainMenu

JMenuItem

System.Windows.Forms.MenuItem

JPanel

System.Windows.Forms.Panel

JPasswordField

System.Windows.Forms.TextBox

JPopupMenu

System.Windows.Forms.ContextMenu

JProgressBar

System.Windows.Forms.ProgressBar  StatusBar

JRadioButton

System.Windows.Forms.RadioButton

JScrollBar

System.Windows.Forms.HScrollBar

System.Windows.Forms.VScrollBar

JScrollPane

System.Windows.Forms.Panel

JSlider

System.Windows.Forms.TrackBar

JSpinner

System.Windows.Forms.DomainUpDown

JSpitPane

System.Windows.Forms.Splitter

JTable

System.Windows.Forms.ListView

JTextArea

System.Windows.Forms.TextBox

JTextField

System.Windows.Forms.TextBox

JTextPane

System.Windows.Forms.RichTextBox

JTogleButton

System.Windows.Forms. ButtonBase

JToolBar

System.Windows.Forms.ToolBar

JToolTip

System.Windows.Forms.ToolTip

JTree

System.Windows.Forms.ListView

Popup

System.Windows.Forms.ContextMenu

Timer

System.Windows.Forms.Timer

javax.swing.event

java

.net

CaratEvent

System.EventArgs

ListDataEvent

System.EventArgs

ListSelectionEvent

System.EventArgs

MenuEvent

System.EventArgs

PopupMenuEvent

System.EventArgs

 

java.awt包

java.awt

java

.net

AWTEvernt

System.EventArgs

AWTKeyStroke

System.Windows.Forms.KeyPressEventArgs

AWTPermission

System.Security.Permissions.UIPermission

BasicStroke

System.Drawing.Pen

Button

System.Windows.Forms.Button

Canvas

System.Windows.Forms. Control

CheckBox

System.Windows.Forms.RadioButton

Choice

System.Windows.Forms.ComboBox

Color

System.Drawing.Color

Component

System.Windows.Forms. Control

Container

System.Windows.Forms. Control

Cursor

System.Windows.Forms.Cursor

Dialog

System.Windows.Forms.CommonDialog

Dimension

System.Drawing.Size

Event

System.EventArgs

FileDialog

System.Windows.Forms.FileDialog

Font

System.Drawing.Font

Frame

System.Windows.Forms.Form

GradientPaint

System.Drawing.Drawing2D.LinearGradientBrush

Graphics

System.Drawing.Graphics

Graphics2D

System.Drawing.Graphics

Image

System.Drawing.Image

JobAttribute

System.Drawing.Printing. PageSettings

Label

System.Windows.Forms.Label

List

System.Windows.Forms.ListBox

Menu

System.Windows.Forms.MainMenu

MenuItem

System.Windows.Forms.MenuItem

PageAttributes

System.Drawing.Printing. PageSettings

Panel

System.Windows.Forms. Panel

Point

System.Drawing.Point

PopupMenu

System.Windows.Forms.ContextMenu

PrintJob

System.Drawing.Printing.PrintDocument

Rectangle

System.Drawing.Rectangle

Scrollbar

System.Windows.Forms.HScrollbar

System.Windows.Forms.VScrollbar

ScrollPane

System.Windows.Forms. Panel

TextArea

System.Windows.Forms. TextBox

TextField

System.Windows.Forms. TextBox

TexturePaint

System.Drawing.TextreBrush

java.awt.event

java

.net

ActionEvent

System.EventArgs

AdjustmentEvent

System.Windows.Forms.ScrollEventArgs

ComponentEvent

System.EventArgs

ContainerEvent

System.Windows.Forms.ControlEventArgs

FocusEvent

System.EventArgs

ItemEvent

System.EventArgs

KeyEvent

System.Windows.Forms.KeyPressEventArgs

MouseEvent

System.Windows.Forms.MouseEventArgs

PaintEvent

System.Windows.Forms.PaintEventArgs

TextEvent

System.EventArgs

WindowEvent

System.EventArgs

java.awt.print

java

.net

PageFormat

System.Drawing.Printing.PageSettings

Paper

System.Drawing.Printing.PageSize

PrinterJob

System.Drawing.Printing.PrintDocument

 
 
1

Java和C#基本类库的区别