views:

78

answers:

3

I think i am lost with basics itself. What is the difference between these two. String object is an instance of String Class.

var guru:Object = new Object();

var guru:String = new String();
+1  A: 

If you're really not sure, I'd suggest looking up the answer here:

http://livedocs.adobe.com/flex/3/html/help.html?content=03_Language_and_Syntax_11.html

Briefly, it states:

String data type

The String data type represents a sequence of 16-bit characters. Strings are stored internally as Unicode characters, using the UTF-16 format. Strings are immutable values, just as they are in the Java programming language. An operation on a String value returns a new instance of the string. The default value for a variable declared with the String data type is null. The value null is not the same as the empty string (""), even though they both represent the absence of any characters.

Object data type

The Object data type is defined by the Object class. The Object class serves as the base class for all class definitions in ActionScript. The ActionScript 3.0 version of the Object data type differs from that of previous versions in three ways. First, the Object data type is no longer the default data type assigned to variables with no type annotation. Second, the Object data type no longer includes the value undefined, which used to be the default value of Object instances. Third, in ActionScript 3.0, the default value for instances of the Object class is null.

If that doesn't satisfy your question, you're going to have to get more specific.

Robusto
+2  A: 

An object is a basic object. It has very few intrinsic properties and methods. More detail here

A string is an extended object that has the properties and methods relevant to strings. More detail here

invertedSpear
+1  A: 

This guide can help you with basic Object Oriented questions regarding ActionScript 3.

The reference guide for String states that String inherits directly from Object.

The String class provides a bunch of useful methods that help with string manipulation on top of the few methods that Object provides (like toString()).

Hooray Im Helping