Arrays, Casting and instanceof, Polymorphism

Having Problems with my programme it compiles but I can't get anything to output when I add a Warden, Rest of code available if you want to compile
Thankyou
import java.util.*;
public class Prison
     private ArrayList <Person> thePersons;
     private String n;
     private int numPrisoners;
     private int numHRPrisoners;
     private int numWardens;
     private int numAllPrisoners;
     private String prisonName;
     private int numAllPrison = (numWardens + numAllPrisoners);
     public Prison (String nameofprison, int numPrisoners, int numHRPrisoners, int numAllPrisoners, int numWardens)
          n = nameofprison;
          numPrisoners = 0;
          numHRPrisoners = 0;
          numAllPrisoners = 0;
          numWardens = 0;
          thePersons = new ArrayList <Person> ();
          public void addPrisoner (Person newPerson)
               numPrisoners++;
               numAllPrisoners++;
               thePersons.add(newPerson);
          public void addHRPrisoner (Person newPerson)
               numHRPrisoners++;
               numAllPrisoners++;
               thePersons.add(newPerson);
          public void addWarden (Person newPerson)
               numWardens++;     
               thePersons.add(newPerson);
          public void DisplayPrisoners()
               System.out.println("Prisoners:");
                    for ( int i =0; i<(numAllPrison); ++i)
                         if (thePersons.get(i) instanceof Prisoner)
                              System.out.println(thePersons.get(i ).toString());
          public void DisplayWardens()
               System.out.println("Wardens:");
                    for ( int i =0; i<(numAllPrison); ++i)
                         if (thePersons.get(i) instanceof Warden)
                              System.out.println(thePersons.get(i ).toString());
          public void DisplayHRPrisoner()
               System.out.println("High Risk Prisoner:");
                    for ( int i =0; i<(numAllPrison); ++i)
                         if (thePersons.get(i) instanceof HRPrisoner)
                              System.out.println(thePersons.get(i ).toString());
     //id for later eneter in keyboard     
     public void DisplayPrisonerID(String id)
          Iterator itr = thePersons.iterator();
          while(itr.hasNext())
               Person nextPersons = (Person)itr.next();
               if (nextPersons instanceof HRPrisoner)
                    Prisoner p = (Prisoner)nextPersons;
                    if(p.getPrisonerID() == id);
                              System.out.println(nextPersons);
     public void ReleasePrisoner(int id)
          Iterator itr = thePersons.iterator();
          while(itr.hasNext())
               Person nextPersons = (Person)itr.next();
               if (nextPersons instanceof Warden)
                    Prisoner p = (Prisoner)nextPersons;
                    if(p.getDaysLeft() <= 7);
                         System.out.println(nextPersons);
                         System.out.println("Prisoner released");
This is not 100% complete but the Warden bit is upto where I have a problem
import java.util.*;
public class TestPrison2
     public static void main (String[] args)
          //delare everything eg from Prisoner etc
          String thePrisonerID;
          String theName;
          String theSurname;
          String theDOB;
          String theSex;
          int theDaysLeft = 0;
          String prisonerID;
          int daysleft = 0;
          String n;
          int numPrisoners;
          int numHRPrisoners = 0;
          int numWardens = 0;
          int numAllPrisoners = 0;
          int theSecurityLevel;
          String theShareCell;
          String prisonName;
          int wardenRank;
          Prison HMEssex = new Prison("HMEssex",0,0,0,0);
          //public TestPrison ();
          // Prison Boring = new Prison();
          int cmd = 1;
          //While(cmd !=0) menu bit with switchy bit at the end
          while (cmd!=0)
               System.out.println("1 Add new Warden");
               System.out.println("2 Add new Prisoner");
               System.out.println("3 Add HR Prisoner");
               System.out.println("4 View all Prisoners");
               System.out.println("5 View all Wardens");
               System.out.println("6 View Prisoner by ID");
               System.out.println("7 Release Prisoner");
               System.out.println("8 Exit");
               //Scanner bits
               Scanner kybd = new Scanner(System.in);
               //make a huge switch statement, delare bollocks
               //switch (int cmd)
               cmd = 1;
               // add Warden
               System.out.println("Enter selection");
               cmd = kybd.nextInt();
               switch(cmd)
                    case 1:
                         String a;
                         System.out.println("Enter Warden name");
                         a = kybd.next();
                         //Warden kybd.next() = new Warden;
                         System.out.println("Enter First Name");
                         String b = kybd.next();
                         System.out.println("Enter Surname");
                         String c = kybd.next();
                         System.out.println("Enter DOB");
                         String d = kybd.next();
                         System.out.println("Enter Gender");
                         String e = kybd.next();
                         System.out.println("Enter Rank");
                         int f = kybd.nextInt();
                         Person warden = new Warden(b,c,d,e,f);
                         HMEssex.addWarden(warden);
                         break;
                    //add a Prisoner
                    case 2:
                         if (numAllPrisoners / 5 < numWardens)
                              String a;
                              System.out.println("Enter Prisoner name");
                              a = kybd.next();
                              //Prisoner kybd.nextString() = new Prisoner;
                              System.out.println("Enter PrisonerID");
                              String b = kybd.next();
                              System.out.println("Enter First Name");
                              String c = kybd.next();
                              System.out.println("Enter Surname");
                              String d = kybd.next();
                              System.out.println("Enter DOB");
                              String e = kybd.next();
                              System.out.println("Enter Gender");
                              String f = kybd.next();
                              System.out.println("Enter days left in prison");
                              int g = kybd.nextInt();
                              Prisoner xb = new Prisoner(b,c,d,e,f,g);
                              HMEssex.addPrisoner (xb);
                         else
                              System.out.println("Not enough Wardens");
                              System.out.println("");
                         break;
                    //add a HRPrisoner
                    case 3:
                         if (numHRPrisoners /4 < numWardens)
                              String a;
                              System.out.println("Enter Prisoner name");
                              a = kybd.next();
                              //HRPrisoner kybd.nextString() = new HRPrisoner;
                              System.out.println("Enter PrisonerID");
                              String b = kybd.next();
                              System.out.println("Enter First Name");
                              String c = kybd.next();
                              System.out.println("Enter Surname");
                              String d = kybd.next();
                              System.out.println("Enter DOB");
                              String e = kybd.next();
                              System.out.println("Enter Gender");
                              String f = kybd.next();
                              System.out.println("Enter days left in prison");
                              int g = kybd.nextInt();
                              System.out.println("Enter security level");
                              int h = kybd.nextInt();
                              System.out.println("Enter if they can share a cell Yes/No");
                              String i = kybd.next();
                              HRPrisoner ac = new HRPrisoner(b,c,d,e,f,g,h,i);
                              HMEssex.addHRPrisoner(ac);
                              break;
                         else
                              System.out.println("Not enough Wardens");
                              System.out.println("");
                    //view Prisoners
                    case 4:
                         HMEssex.DisplayPrisoners();
                         break;
                    //view Wardens     
                    case 5:
                         HMEssex.DisplayWardens();
                         break;
                    //Search for Prisoner by ID               
                    case 6:
                         break;
                    //Release a Prisoner                    
                    case 7:
                         if (daysleft < 7)
                         break;
                    //exit programme
                    case 8:
                         System.exit(0);
                    default:
                    System.out.println("Not an option please choose again");
}

Next time post code like this. What your program intends to do and what it does now.
import java.util.*;
public class Prison
private ArrayList <Person> thePersons;
private String n;
private int numPrisoners;
private int numHRPrisoners;
private int numWardens;
private int numAllPrisoners;
private String prisonName;
private int numAllPrison = (numWardens + numAllPrisoners);
public Prison (String nameofprison, int numPrisoners, int numHRPrisoners, int numAllPrisoners, int numWardens)
n = nameofprison;
numPrisoners = 0;
numHRPrisoners = 0;
numAllPrisoners = 0;
numWardens = 0;
thePersons = new ArrayList <Person> ();
public void addPrisoner (Person newPerson)
numPrisoners++;
numAllPrisoners++;
thePersons.add(newPerson);
public void addHRPrisoner (Person newPerson)
numHRPrisoners++;
numAllPrisoners++;
thePersons.add(newPerson);
public void addWarden (Person newPerson)
numWardens++;
thePersons.add(newPerson);
public void DisplayPrisoners()
System.out.println("Prisoners:");
for ( int i =0; i<(numAllPrison); ++i)
if (thePersons.get(i) instanceof Prisoner)
System.out.println(thePersons.get(i ).toString());
public void DisplayWardens()
System.out.println("Wardens:");
for ( int i =0; i<(numAllPrison); ++i)
if (thePersons.get(i) instanceof Warden)
System.out.println(thePersons.get(i ).toString());
public void DisplayHRPrisoner()
System.out.println("High Risk Prisoner:");
for ( int i =0; i<(numAllPrison); ++i)
if (thePersons.get(i) instanceof HRPrisoner)
System.out.println(thePersons.get(i ).toString());
//id for later eneter in keyboard
public void DisplayPrisonerID(String id)
Iterator itr = thePersons.iterator();
while(itr.hasNext())
Person nextPersons = (Person)itr.next();
if (nextPersons instanceof HRPrisoner)
Prisoner p = (Prisoner)nextPersons;
if(p.getPrisonerID() == id);
System.out.println(nextPersons);
public void ReleasePrisoner(int id)
Iterator itr = thePersons.iterator();
while(itr.hasNext())
Person nextPersons = (Person)itr.next();
if (nextPersons instanceof Warden)
Prisoner p = (Prisoner)nextPersons;
if(p.getDaysLeft() <= 7);
System.out.println(nextPersons);
System.out.println("Prisoner released");
This is not 100% complete but the Warden bit is upto where I have a problem
import java.util.*;
public class TestPrison2
public static void main (String[] args)
//delare everything eg from Prisoner etc
String thePrisonerID;
String theName;
String theSurname;
String theDOB;
String theSex;
int theDaysLeft = 0;
String prisonerID;
int daysleft = 0;
String n;
int numPrisoners;
int numHRPrisoners = 0;
int numWardens = 0;
int numAllPrisoners = 0;
int theSecurityLevel;
String theShareCell;
String prisonName;
int wardenRank;
Prison HMEssex = new Prison("HMEssex",0,0,0,0);
//public TestPrison ();
// Prison Boring = new Prison();
int cmd = 1;
//While(cmd !=0) menu bit with switchy bit at the end
while (cmd!=0)
System.out.println("1 Add new Warden");
System.out.println("2 Add new Prisoner");
System.out.println("3 Add HR Prisoner");
System.out.println("4 View all Prisoners");
System.out.println("5 View all Wardens");
System.out.println("6 View Prisoner by ID");
System.out.println("7 Release Prisoner");
System.out.println("8 Exit");
//Scanner bits
Scanner kybd = new Scanner(System.in);
//make a huge switch statement, delare ********
//switch (int cmd)
cmd = 1;
// add Warden
System.out.println("Enter selection");
cmd = kybd.nextInt();
switch(cmd)
case 1:
String a;
System.out.println("Enter Warden name");
a = kybd.next();
//Warden kybd.next() = new Warden;
System.out.println("Enter First Name");
String b = kybd.next();
System.out.println("Enter Surname");
String c = kybd.next();
System.out.println("Enter DOB");
String d = kybd.next();
System.out.println("Enter Gender");
String e = kybd.next();
System.out.println("Enter Rank");
int f = kybd.nextInt();
Person warden = new Warden(b,c,d,e,f);
HMEssex.addWarden(warden);
break;
//add a Prisoner
case 2:
if (numAllPrisoners / 5 < numWardens)
String a;
System.out.println("Enter Prisoner name");
a = kybd.next();
//Prisoner kybd.nextString() = new Prisoner;
System.out.println("Enter PrisonerID");
String b = kybd.next();
System.out.println("Enter First Name");
String c = kybd.next();
System.out.println("Enter Surname");
String d = kybd.next();
System.out.println("Enter DOB");
String e = kybd.next();
System.out.println("Enter Gender");
String f = kybd.next();
System.out.println("Enter days left in prison");
int g = kybd.nextInt();
Prisoner xb = new Prisoner(b,c,d,e,f,g);
HMEssex.addPrisoner (xb);
else
System.out.println("Not enough Wardens");
System.out.println("");
break;
//add a HRPrisoner
case 3:
if (numHRPrisoners /4 < numWardens)
String a;
System.out.println("Enter Prisoner name");
a = kybd.next();
//HRPrisoner kybd.nextString() = new HRPrisoner;
System.out.println("Enter PrisonerID");
String b = kybd.next();
System.out.println("Enter First Name");
String c = kybd.next();
System.out.println("Enter Surname");
String d = kybd.next();
System.out.println("Enter DOB");
String e = kybd.next();
System.out.println("Enter Gender");
String f = kybd.next();
System.out.println("Enter days left in prison");
int g = kybd.nextInt();
System.out.println("Enter security level");
int h = kybd.nextInt();
System.out.println("Enter if they can share a cell Yes/No");
String i = kybd.next();
HRPrisoner ac = new HRPrisoner(b,c,d,e,f,g,h,i);
HMEssex.addHRPrisoner(ac);
break;
else
System.out.println("Not enough Wardens");
System.out.println("");
//view Prisoners
case 4:
HMEssex.DisplayPrisoners();
break;
//view Wardens
case 5:
HMEssex.DisplayWardens();
break;
//Search for Prisoner by ID
case 6:
break;
//Release a Prisoner
case 7:
if (daysleft < 7)
break;
//exit programme
case 8:
System.exit(0);
default:
System.out.println("Not an option please choose again");
}

Similar Messages

  • [svn:bz-trunk] 20004: Remove unneeded cast and instanceof check for FlexConfigurable.

    Revision: 20004
    Revision: 20004
    Author:   [email protected]
    Date:     2011-01-28 11:13:07 -0800 (Fri, 28 Jan 2011)
    Log Message:
    Remove unneeded cast and instanceof check for FlexConfigurable.
    No functional change.
    Modified Paths:
        blazeds/trunk/modules/core/src/flex/messaging/FactoryDestination.java

  • Dynamic class cast and instanceof

    I am looking for a way to dynamically test an object for being of a specific class. The instanceof operator can only be used with literally named classes I understand. So you cannot have something like boolean checkClass( Object o, Class c ) {
       return o instanceof c;
    } Is there any way to do something like this by use of the reflection API? The point is that instanceof only works statically, the reference type being tested for being specified at compile time. The question is whether it can be done with a reference type being specified at run-time, ie dynamically.

    There is a collection of parameters of various types, which is passed to some client module.
    There should be a, say 'checkParam' method for the client, which checks for existence of a certain parameter by its name, and also specified which class the parameter should have. So it should be called like
    checkParam( params, "paramName", String.class )I wanted to avoid hard-coded types, but have the class specified as an argument to this method. I feel like there should be some way to accomplish that. What swingfreak intended may be a way.

  • Narrow cast and wide cast in ABAP OO

    Hi Xperts
    Considering the code below can the concepts of narrowing cast and widening cast be explained ? Kindly help me in getting a clear picture of the usage of it.
    CLASS C1 DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA: COUNT TYPE I.
        CLASS-METHODS: DISP.
    ENDCLASS.                    "defintion  C1
    CLASS C1 IMPLEMENTATION.
      METHOD DISP.
        WRITE :/ COUNT.
      ENDMETHOD.                    "disp
    ENDCLASS.                    "c1 IMPLEMENTATION
    CLASS C2 DEFINITION INHERITING FROM C1.
      PUBLIC SECTION.
        CLASS-METHODS: GET_PROP.
    ENDCLASS.                    "c2  INHERITING C1
    CLASS C2 IMPLEMENTATION.
      METHOD GET_PROP.
        COUNT = 9.
        CALL METHOD DISP.
      ENDMETHOD.                    "get_prop
    ENDCLASS.                    "c2 IMPLEMENTATION
    START-OF-SELECTION.
      DATA: C1_REF TYPE REF TO C1,
            C2_REF TYPE REF TO C2.
    PS: Pls dont post any links as i already gone thru couple of those in SDN but couldnt get a clear info

    Hi
    I got to know abt narrow cast: referecing a super class ref to a subclass ref so that the methods in subclass can be accessed by the super class reference. Below is snippet of the code i'd checked. Hope this is correct to my understanding. If any faults pls correct me. Also if anyone can explain wideing cast in this context will be very helpful
    FOR NARROW CAST
    {size:8}
    CLASS C1 DEFINITION.
      PUBLIC SECTION.
        CLASS-DATA: COUNT TYPE I.
        CLASS-METHODS: DISP_COUNT.
    ENDCLASS.                    "defintion  C1
    CLASS C1 IMPLEMENTATION.
      METHOD DISP_COUNT.
        WRITE :/ 'Class C1', COUNT.
      ENDMETHOD.                    "disp
    ENDCLASS.                    "c1 IMPLEMENTATION
    CLASS C2 DEFINITION INHERITING FROM C1.
      PUBLIC SECTION.
        CLASS-METHODS: GET_PROP,
                       DISP.
    ENDCLASS.                    "c2  INHERITING C1
    CLASS C2 IMPLEMENTATION.
      METHOD GET_PROP.
        COUNT = 9.
        CALL METHOD DISP.
      ENDMETHOD.                    "get_prop
      METHOD DISP.
        WRITE :/ 'Class C2', COUNT.
      ENDMETHOD.                    "DISP
    ENDCLASS.                    "c2 IMPLEMENTATION
    START-OF-SELECTION.
      DATA: C1_REF TYPE REF TO C1,
            C2_REF TYPE REF TO C2.
      CREATE OBJECT: C2_REF TYPE C2.
    *  CREATE OBJECT: C1_REF TYPE C1.
      BREAK-POINT.
      C1_REF = C2_REF.
      CALL METHOD C1_REF->DISP_COUNT.
      CALL METHOD C1_REF->('GET_PROP').
    {size}
    Edited by: Prabhu  S on Mar 17, 2008 3:25 PM

  • Narrowing cast and widening cast

    Hi All,
           I want to know what is the use of a narrowing cast and a widening cast in ABAP objects.
    Can someone please give an example ?
    Regards,
    Ashish

    Hi,
    Check out this link, This will guide you on ABAP Objects
    http://www.sap-press.de/katalog/buecher/htmlleseproben/gp/htmlprobID-28?GalileoSession=22448306A3l7UG82GU8#level3~3
    Both narrow and wide casting are related to inheritance.
    In Narrow casting, you assign a runtime object of subclass to runtime object of superclass. By this assignment , you can access your subclass by using runtime object of your superclass. But here the important point is that, you are assigning subclass reference to super class reference, so you can only access the inherited components of subclass through super class reference.
    Suppose you have a super class lcl_vehicle. it has two subclasses lcl_car and lcl_truck.
    r_vehicle = r_car.
    In Wide casting, you assign a superclass reference to subclass reference . Before this, you do narrow casting,
    Now when you assign a superclass reference to subclass reference. You can access the inherited as well as the specific components of subclass.
    taking the same example,
    r_car ?= r_vehicle.
    '?='  wide cast operator.
    Regards
    Abhijeet

  • Narrow Cast and Widening cast in OOPs

    hi friends,
    Can u please clear with the above two concepts ..... i have many doubts on this ...
    first of all Y we need the concept of Narrow cast and widenning cast ?
    Expecting your answers ...
    Thanks in advance
    Cheers
    Kripa Rangachari .....

    hi Kripa,
    “Narrowing” cast means that the assignment changes from a more specialized view (with visibility to more components) to a more generalized view (with visibility to fewer components).
    “Narrowing cast” is also referred to as “up cast” . “Up cast” means that the static type of the target variable can only change to higher nodes from the static type of the source variable in the inheritance tree, but not vice versa.
    <b>Reference variable of a class assigned to reference variable of class : object</b>
    class c1 definition.
    endclass.
    class c1 implementation.
    endclass.
    class c2 definition inheriting from c1.
    endclass.
    class c2 implementation.
    endclass.
    start-of-selection.
    data : oref1 type ref to c1,
            oref2 tyep ref to c2.
    oref1 = oref2.
    <b>Widening Cast</b>
    DATA:     o_ref1 TYPE REF TO object,                o_ref2 TYPE REF TO class.
    o_ref2 ?= o_ref1.
    CATH SYSTEM-EXCEPTIONS move_cast_error = 4.
         o_ref2 ?= o_ref1.
    ENDCATCH.
    In some cases, you may wish to make an assignment in which the static type of the target variable is less general than the static type of the source variable. This is known as a widening cast.
    The result of the assignment must still adhere to the rule that the static type of the target variable must be the same or more general than the dynamic type of the source variable.
    However, this can only be checked during runtime. To avoid the check on static type, use the special casting operator “?=“ and catch the potential runtime error move_cast_error
    Regards,
    Richa

  • Exe OK but htm + exe ignores cast and htm + dcr fails

    I've published an .exe with a calling .htm file with Director MX.
    The .exe runs OK  when double clicked in Windows explorer, but when run from the accompanying .htm the Shockwave player runs the .exe 'OK' but the external cast is ignored.
    If I publish it as a .dcr + .htm,  Shockwave produces a message to the effect that the Shockwave movie has problems that prevent playback.
    Is this a query for the Shockwave forum or can anyone here help?
    Thank you..

    Sean, thanks for coming back. Having failed to get the .dcr to run I though running the .exe might give me a clue.
    I imagined that the .exe was a chunk of code with the cast members and xtras used internally as required. It hadn't occurred to me that the Shockwave player would be looking at the cast and weeding out the xtras it objected to.
    I send out cds to my students with their course material in the form of Director.exes.
    The current plan is to put the files on our website for them to access. I thought that there would be problems if we provided exes to download hence  my attempt to let them run the movies from the site via the Shockwave player.
    It may be the case, as jchunick suggests, that I have an unsafe Shockwave Xtra.
    I'm now looking for a (quick?) means of testing which Xtras the player considers safe.

  • Fumbling through V CAST and LG COSMOS Touch Music / pics setup

    OK basically I'm trying to set up my phone (LG cosmos touch) on V CAST and of course I added a MicroSD (8Gig) card. I have songs listed in V cast, and even created a playlist for them and moved them from the "local media content" to the playlist I created in V cast. Here's the problem;
    I plug in the phone and V cast doesn't see it at all at first.
    I go into my phone and "My Music" and hit the "sync" button which SHOULD just suck 'em up, right?
    THEN I get a message on V CAST that my phone is IN SYNC MODE has to be in USB MASS STORAGE MODE to work.
    There's a handy-dandy little video that even tells me how to do it on my new phone...
    I put the phone into USB MASS STORAGE MODE (Menu>tools>Mmemory>) and...
    Now V CAST SEES THE PHONE AS A DRIVE (G
    I can now NOT get to the My Music and "Sync" commands on the phone wihtout dropping out of the USB MASS STORAGE MODE.
    I CANT SYNC... so I drag and drop
    I drag the playlist to the "drive" in the left column and it copies and shows up in V CAST.
    ALL THE SONGS are on the chip...
    In the phone, there's no playlist, and no songs show up in the "My Music" section... No playlists show, no songs under "all songs." It's like tehyre not on the chip. V CAST says there is and theyre there... Phone says NADA...
    WTH is going on?
    To "SYNC" i cannot be in USB MASS STORAGE MODE
    IN USB MASS STORAGE MODE I can copy the playlist and songs to the chip as you would a drive, but the phone's not going to find them, and I cannot SYNC in USB MASS STORAGE MODE.
    GRRRRRRRRRRRRRRRRRR !!!!  Frustrated!

    wow, very nice review Makes me want to get a vision for myself.
    WebKnight wrote:
    <SPAN>
    Add the ability to randomly select a new background from a pre selected group of photos every time the player is turned on or each day.
    I would love that feature. I can't stand useing my computer with a single wall paper anymore (I have 500 anime pics that i rotate between every 2 mins ) If you could make the vision rotate background every x minutes or every time the player is turned on, it would be totally amazeningly sweet!!!! (i might have to go out and buy one then :P)
    I just hope that creative has better firmware support with the vision than they have had with the touch.
    Once again, great review

  • Cast and Crew Credits for Home Videos

    Hi Folks,
    When I purchase a movie from the iTunes store It comes with limited cast and crew credits shown alongside the cover art. How can I add similar information for my Home Videos?
    I have looked in "Get Info" on a purchased Movie, but can't see where this information resides.
    Many thanks,
    David.

    If someone knows that this simply can not be done, knowing that would save me a lot of hassle trying to work it out... Otherwise I will shut up and be more patient.
    Many thanks as always,
    David.

  • Cast and convert

    Hi Team,
    could you please tell me where do we use cast and convert functions.
    What is the main difference between these two with examples.
    Thanks in advance.
    Mamatha

    I do remember using CAST when creating views with NULL values as columns (For some purpose it was required).
    If you dont use CAST when used null as column, the view column will be created as VARCHAR2(0). This will be an issue in some reporting tools.
    So using CATS you can change the data type to NUMBER or VARCHAR(50) (Example)
    SQL> create or replace view v1 as select null as col1 from dual;
    View created.
    SQL> desc v1
    Name                                      Null?    Type
    COL1                                               VARCHAR2
    SQL> create or replace view v1 as select cast(null as varchar2(50)) as  col1 from dual;
    View created.
    SQL> desc v1
    Name                                      Null?    Type
    COL1                                               VARCHAR2(50)CAST is also used with MULTISET, when working with OBJECT TYPEs..
    Read Here
    CONVERT is used when you want to see a particular text or column in a diffrent character set than the stored one. I have never used it , though...
    Edited by: jeneesh on Oct 12, 2012 6:05 PM

  • Cast and Crew Credits

    Quick question... I hope...
    How do I add "Cast and Crew" credits to my home movies to be the same as purchased "Hollywood" movies?
    I have had a look in the "get info" sections for purchased movies in order to use the same sections for my details, but can't see where this detail is registered.
    Thanks for any help.
    David.

    If someone knows that this simply can not be done, knowing that would save me a lot of hassle trying to work it out... Otherwise I will shut up and be more patient.
    Many thanks as always,
    David.

  • What is upcast/ narrowing cast and widening cast/downcast?

    Hi All SAPIENT,
    What is upcast/ narrowing cast and widening cast/downcast?Why we are using upcast and downcast?Please send me good reply to my mail id pankaj.sinhas2gmail.com.
    Regards
    Pankaj Sinha.

    Hi Srinivasulu,
    Narrowing cast means whenever Sub-Class Reference is Assigned to a Super Class reference it is Narrowing Cast,
    Widening cast means Super Class reference  is Assigned to a Sub-Class Reference then it is Widening Cast.
    See the following links for more information,
    [http://help-abap.blogspot.com/2008/09/abap-objects-narrowing-cast-upcasting.html]
    [http://help-abap.blogspot.com/2008/09/abap-objects-widening-cast-down-casting.html]
    Regards,
    Raghava Channooru.

  • Does Touch have "remove color cast" and adjust lighting - levels like Photoshop Elements?

    Does Touch have "remove color cast" and adjust lighting -> levels like Photoshop Elements?

    There isn't a "remove color cast" command per se but there are Levels and Curves adjustments so you can effectively remove/diminish colors yourself.

  • Rental Movie Cast and Credits

    Why do iTune movie rentals not contain the cast and credits for the movie?

    If it's not in the computer's Trash - and I don't believe a rented movie will go into the Trash if you manually delete it, but check to be sure - then it's gone and you'll have to rent it again.
    Regards.

  • HT1498 The 'Cast and Crew' credits when renting and buying movies

    The 'Cast and Crew' credits when renting and buying movies only shows the Director, Actors and Producers... Surely there should be a fuller credit list? At least the heads of each department?

    If the films aren't including all the credits then that is because the studios aren't including them in the film's file that they pass to Apple. You can try leaving feedback for Apple, but ultimately it's the studios that will have to provide the info in their films : http://www.apple.com/feedback/

Maybe you are looking for