Different ways to create an object

Hi All,
I am a new bie to java programming. I know the way to create an object for a class will be something like
A b = new A(); // A is the class name and b is the object name.
But i am not sure what the following code means, I know it is also creating an object but how and why in that manner.
CaptureSearchForm userBean = (CaptureSearchForm) form;
A b = (A) c;
If b is the object name, then what is c here?Can anyone please explain me in detail.
Also,
java.util.List pageList = new ArrayList();
Why should we give in the above manner? what does it mean?
Thanks in advance....,,,,

auto wrote:
But i am not sure what the following code means, I know it is also creating an object but how and why in that manner.
CaptureSearchForm userBean = (CaptureSearchForm) form;This does not create an object. It takes the value in the reference variable foram and copies it into the refernce variable userBean, so that userBean and form both point to the same object. The (CaptureSearchForm) is called a cast. It tells the compiler that even though form may not be declared to be of type CaptureSearchForm or a subclass, you the programmer know that the object it points to will be a CaptureSearchForm or a subclass, and to treat it as such. If at runtime this is not the case, you'll get a ClassCastException.
A b = (A) c;
If b is the object name, then what is c here?Can anyone please explain me in detail. b is not the object name. Objects do not have names. b and c are both variable names.
Also,
java.util.List pageList = new ArrayList();
Why should we give in the above manner? what does it mean?It's known as programming to the interface. On the LHS, you're saying that pageList must point to an object that implements List. You don't cae if it's an ArrayList or LinkedList or something else. It's a way to decouple your code from the specific implementations of the types it uses.

Similar Messages

  • URGENT Different ways of creating portals (Daniel & subbu Have a look and answer)

    Hi all,
         My primary aim is to run an existing application in a portal server.
    My application is running in weblogic6.1. I need to provide a link to that application
    from a portlet.
    I was going thro' the newsgroups and I found out the following responses for my
    requirement,
    I am not clear with these answers.
    1) I need to know what is an IFRAME and some more steps to execute the answer
    given by
    Daniel selman.
    2) Can I convert an URL into portlet?
         This URL content should be shown as it, without has to write any code from the
    side of developer.
    Plz give me some detailed steps to execute this.
    If you guyz can give me some good reference document probably a cook book sort
    of thing, then I will feel more comfortable.
    Thanx in advance,
    Prasanna
    Different ways of creating portlets
    Answered By Daniel selman.
    You can also use an IFRAME inside a Portlet to "include" an external URL within
    a Portlet page.
    I have attached an example of doing this (content.jsp for the portlet uses an
    IFRAME to include www.google.com).
    Can I convert an URL into portlet?
    Answered By Subbu Allamaraju <subbuATBeaDOTCom>
    This URL content should be shown as it, without has to write any code from the
    side of developer. The example provided in portal installation needs demonstrates
    this feature to some extent. But the developer is supposed to extract HTML content
    he/she wants to see and put it in the JSP.
    If the URL is pointing to a page in the same web app, it is straight forward
    to make it a portlet.
    I have few JSPs running in a machine that is remote to the portal node, and which
    is accessible through a proxy from portal. Can I convert these applications into
    portlets?
    Answered By Subbu Allamaraju <subbuATBeaDOTCom>
    The easiest approach is make those remote apps available as web services. Please
    look at the portal wizard that can create portlets to talk to web services. The
    same wizard will also help convering remote
    URLs to portlets.
    I have a full fledged webapplication running on weblogic server. But for some
    additional features (commercial services) I need to used portal server. How do
    i modify the existing site for the desired
    change?
    Answered By Subbu Allamaraju <subbuATBeaDOTCom>
    This will involve some amount of redesign since you're converint a regular web
    site into a portal (the domain/portal wizards will help you do this). You'll then
    need to create a new portal app, and convert those web apps into portlets, and
    add these portlets to the new portal app.

    Prasanna,
    It is impossible to answer this question is a general way, it all depends on
    what the other web application is doing. If it is just returning static HTML
    then a home-grown solution (scrape taglib / IFRAME) and some URL rewriting
    will suffice. If the remote application requires authentication, uses SSL,
    cookies, Javascript, displays pop-ups etc. then things can get complicated
    extremely quickly. At that point you probably need to use a 3rd-party web
    scraping engine (Kapow for example. Peter Laird posted a list of many
    others.)
    There are network throughput, single sign-on, and performance issues to
    consider. Obviously the most performant solution entails converting your
    exisitng WLS application into a Portal application, by refactoring its JSPs,
    deploying its EJBs etc. Alternatively making remote calls into your business
    objects (EJBs) or deploying WebServices to extract the DATA from the remote
    application independent of the presentation may be an option for well
    architected applications.
    So, sorry, I'm afraid it is very hard to generalize these things into much
    more than a list of issues that you should consider as you work through the
    possible solutions.
    FYI: IFRAME is supported by IE 5+ and Netscape 6.x:
    http://www.webreview.com/browsers/browser_implementation.shtml
    Sincerely,
    Daniel Selman
    "Prasanna" <[email protected]> wrote in message
    news:[email protected]...
    >
    Hi all,
    My primary aim is to run an existing application in a portal server.
    My application is running in weblogic6.1. I need to provide a link tothat application
    from a portlet.
    I was going thro' the newsgroups and I found out the following responsesfor my
    requirement,
    I am not clear with these answers.
    1) I need to know what is an IFRAME and some more steps to execute theanswer
    given by
    Daniel selman.
    2) Can I convert an URL into portlet?
    This URL content should be shown as it, without has to write any code fromthe
    side of developer.
    Plz give me some detailed steps to execute this.
    If you guyz can give me some good reference document probably a cook booksort
    of thing, then I will feel more comfortable.
    Thanx in advance,
    Prasanna
    Different ways of creating portlets
    Answered By Daniel selman.
    You can also use an IFRAME inside a Portlet to "include" an external URLwithin
    a Portlet page.
    I have attached an example of doing this (content.jsp for the portlet usesan
    IFRAME to include www.google.com).
    Can I convert an URL into portlet?
    Answered By Subbu Allamaraju <subbuATBeaDOTCom>
    This URL content should be shown as it, without has to write any code fromthe
    side of developer. The example provided in portal installation needsdemonstrates
    this feature to some extent. But the developer is supposed to extract HTMLcontent
    he/she wants to see and put it in the JSP.
    If the URL is pointing to a page in the same web app, it isstraight forward
    to make it a portlet.
    I have few JSPs running in a machine that is remote to the portal node,and which
    is accessible through a proxy from portal. Can I convert theseapplications into
    portlets?
    Answered By Subbu Allamaraju <subbuATBeaDOTCom>
    The easiest approach is make those remote apps available as web services.Please
    look at the portal wizard that can create portlets to talk to webservices. The
    same wizard will also help converingremote
    URLs to portlets.
    I have a full fledged webapplication running on weblogic server. But forsome
    additional features (commercial services) I need to used portal server.How do
    i modify the existing site for thedesired
    change?
    Answered By Subbu Allamaraju <subbuATBeaDOTCom>
    This will involve some amount of redesign since you're converint a regularweb
    site into a portal (the domain/portal wizards will help you do this).You'll then
    need to create a new portal app, and convert those web apps into portlets,and
    add these portlets to the new portal app.

  • Different ways in Creating BP

    Hi,
      Can somebody brief me the different ways for Creating BP in cProjects?
    If i create a BP in SAP R/3 which BP role do i need to use for creating an external resource as Business Partner?
    With path for creation will be appriciated
    Rgds
    Sudhir Reddy

    Hi,
    We had this scenario where we had a separate ERP system and a standalone CRPXRPM system. The replication was done via ALE.
    The report RHALEINI (T-Code - PFAL) was used to move the HR Master data to the cProjects sytem.
    The BPs are created with 'Employee' role. Not very sure, but I think its BUP0003. However, you need to maintain these BPs in the 'Resource' role if you want to maintain their cost/revenue rates.
    We used the field 'BP Type' to differentiate external employees.
    Let me know if you found this helpful.
    Regards,
    Vivek

  • Best way to creat an OBJECT in OM

    Hi All,
    As i know there are multiple options available to create Objects for OM,
    Now what is the best possible way to create number of Objects in OM Out of the following.
    PPOCE
    PPOC_OLD,
    PP01,
    PO03,PO10,PO13
    Please guide.

    You need to understand 3 core things to have good understanding of OM..
    1) Objects
    2) Relationships
    3) Attributes
    Each element of your org. structure is an Object. It is related with another object and it has certain attributes..
    Org. Unit, Position and Person are different examples of objects each of which has its own attributes.. when you link them together it forms your org. strcture..
    To depict very basic structure, you can use "Simple Maintenance" option.
    You can use "Expert Mode" to define attributes of the objects..
    And to do both activities at one place, you can do so through "Org. & Staffing" interface..
    So organizational and Staffing interface is in detailed and coprehensive you may use it for better understandings.
    The following are the detail transaction you may use .
    AREA Mene     T-CODES     List of Activity
         PP70     SAP Easy Access Organizational Management
         PP7S     SAP Easy Access Organizational Management
    Organization and Staffing      T-CODES     List of Activity
         PPOCE      Create
         PPOME      Change
         PPOSE      Display
    General structures           
         PPSC     Create
         PPSM     Change
         PPSS     Display
    Matrix          
         PPME     Change
         PPMS     Display
    Expert mode           
         PO10     Organizational unit
         PO03     Job
         PO13     Position
         PO01     Work center
         PFCT     Task catalog
         PP01     General
    Simple maintenance           
         PPOC_OLD - Create      
         PPOM_OLD - Change      
         PPOS_OLD - Display      
    Regaards
    Barket Ali Zafar
    SAP HCM Consultant
    Siemens Pakistan
    +92-300-5521524

  • Different ways to create content in dreamweaver

    So Its been a while since I used Dreamweaver, and from what I remember, there was a way for me to "draw" a box on a page, and then I could put text , images or anything else I needed on the page. It probably wasn't the most professional way to create a page, but it worked for me. Now that I have CS5.5, I can't seem to figure out how I did that.
    The reason why I did it this way was because I knew where everything was going to be once I published the page. It was almost like creating content in a DTP, you drew a box and either put text or images....anyway, if anyone knows what I'm refering to, and I can still do this in 5.5, please let me know.....
    Thanks in advance for your help!
    Chaz

    APDiv Layers are gone and for good reason.  They lulled inexperienced users into a false sense of power & security that everything was lining up correctly for all users, displays and browsers.  Actually  this was the worst possible way to design for the web. You can read why below.
    http://www.apptools.com/examples/pagelayout101.php
    Fast forward to today where everyone uses different sized devices: mobile, tablets, desktops, and APDivs won't work.   
    Best advice, use the CSS starter pages.  Go to File > New > Blank page> HTML and pick a layout from the 3rd panel.  Hit Create button.   Add your own text, images and backgrounds.  Much better than APDiv Layers.
    Nancy O.

  • A different way to create a new object?

    Hi all!
    I have an array of type Object were I'm inserting different data types (String,Integer and so on..) now I want to go over this array and I want to create
    a new object that is not(!) a clone of the object in a given position but is the same type (the downcasted type)
    I want to implement it in a single command but not in series of if (.. instance of ..)
    The new value should be inserted into an array of Object too so I assume it will implicitly downcast it automatically.
    how can I do that? I hope you understand the problem..
    thanks
    omer
    Edited by: omerkap on Dec 29, 2009 8:27 AM

    omerkap wrote:
    what do you want?!To engage in a reasonable discussion. How about you?
    I came here to ask a very specific question about a way to implement something.Many folks do. And they often ask how to implement their solution in a way that is impractical or inefficient. Sometimes, they attempt to incorporate better ideas when given suggestions for better implementations. Sometimes, they just throw miniature temper tantrums.
    You purposed another way? ok, thanks, but I need to know how to do it in the original way I asked.Well, no. You said what you wanted to do. Now that it's a need, my advice is different.
    I proposed an idea for a simple solution to accomplish the general requirements you originally mentioned. If you have design restrictions that mandate you write code in a certain way or to fulfill a particular design, then you should comply with those restrictions. Personally, I like to guide folks toward a useful design. If you don't want to be guided that way, that's certainly your prerogative.
    As it stands now, it sounds like you have an assignment. And I suspect that assignment isn't intended to test your ability to copy a solution someone gave you on an internet forum. It sounds like the assignment requires the use of a lengthy if chain. I recommend you comply with your requirements.
    As an aside, you could use a Map<String, InstructionBuilder>(), but you'd be getting into some serious class bloat for what I presume is a relatively small, simple app. You could also probably hack up something with reflection, but that's probably out-of-bounds with your requirements as well.
    You don't want to answer? Don't know where you got that idea. I post here only when I want to.
    ~

  • Is there a way to create an object using Trapcode Form and then use that object as a particle in Trapcode Particular?

    I made some objects in Cinema 4D and I tried to import them into After Effects CC 2014.  I get an error saying 'Cannot find Adobe Premiere Pro Dynamic Link'.  So I tried it in AE CC and that worked.  However, I want to create a form object and then use that as a particle for Trapcode Particular.  Is this even possible?
    Thank you for any help!

    There are also size limitations or rather suggestions for particle size. If I were creating an animated 3D shape using Form or C4D and wanted to use it as a particle I would keep the size of the particle about 1/6 to 1/8 of the comp size. You would create a new comp for your particle, animate it, then nest the particle comp in your main comp, turn off visibility, and then use it as a particle in Particular.

  • A way to create new object instances in a loop?

    I have an square matrix of String values.
    Is there a way to take each row, make it into an object, and put the object in a new square matrix of objects?
    Any ideas?

    Do you mean something like this:Integer[][] foo = new Integer[5][5];
    for (int i = 0; i < foo.length; i++) {
        for (int j = 0; j < foo.length; j++) {
    foo[i][j] = new Integer(i + j);
    }It's hard to guess what you want, why not post some code (use the code tags: Formatting tips)

  • Different ways to create a blog entry

    I'm using iWeb '08. I have set up several blog pages and want to allow people to update them outside of iWeb. Is there a way to accomplish this?

    No. iWeb is required to make new entries (but not for comments of course).

  • How many WAYS are there to CREATE an OBJECT?

    I simply know about implicit creation and explicit creation:
    String name = "Asim Munir"; //Implicit
    String name = new String("Asim Munir"); // Explicit
    Do you have any other way to create an object?

    Hi,
    Basically in Java, an object is created by using the new keyword. This is the actual object creation. So far String is concerned, there is a trick what you have mentioned.
    Plz go through it.
    String str = "India"; It is also String object. But internally, Java maintains a String Constant pool to maintain the String object. When you are writing the above statement, it will first check the value "India" in the String Constant pool and it it does not find, then it will create an object. If it finds, it will not create but simply it maintain a reference to that "India" object. So here only one object is created. But in the following case.
    String str = new String("India");
    Here two objects are created. Just try to understand how two objects are created. If you have any problem, feel free to mail
    Debadatta Mishra
    [email protected]

  • Create View Object programattically from XML input

    Hi,
    I have requirement to create view object from xml at run time in ADF application. is there any way to create view object dynamically in java program from xml?
    My requirement is to call a webservice and generate view object from the response of the web service call.
    Thanks

    I want to create view objects from different web services and the same will be available to the developer at the time of development. I don't want to create web service proxies for each of the web service. this will simplify the developers task to create proxy and data controls. the one thing developer has to do is select the service and base on the service the view objects will be created to develop pages accordingly.

  • How to Create the object to intract with the registry

    Hi
    like in windows eg " In scripts we can give as CreateObject to create an object " that object can intract directly to the registry of the windows and we can retrive many system info with the help of that object.
    My query ?? Is something like that is possible here in mac while not having the centralized registry system..
    if not then what is the way to create an object here in Cocoa so that i cud get the system specific info with that ??

    I understand (at least some of) the principles of programming VBScript. What I'm saying is that the rules are very different here. It is almost certainly possible to obtain equivalent functionality via AppleScript, but that path you take to get there may be very different.
    For example, there is no need to explicitly instantiate objects. If you want to target a specific application you just say so, e.g.
    <pre class=command>tell application "Mail"</pre>
    Now everything you do will be targeted to the Mail application. What commands you can issue will depend on the application in question. You can use the Open Dictionary command within Script Editor to see what classes (objects) and commands the application understands.

  • Ways to initialize an object

    Hypothetically, say I was to create an NSString object in a program. I could use
    NSString *string = @"This is a string.";
    or
    NSString *string = [[NSString alloc] initWithString: @"This is a string."];
    or
    [NSString stringWithString: @"This is a string."];
    and I'm sure there are other methods. Which one would be "best?" Why would I choose one method over another in a specific circumstance?

    MacHamster wrote:
    I'm rather new to this and so what I'm about to say might actually be highly erroneous, in which case I hope someone will tell me if it is!
    No, you are absolutely correct. It is just that there are some funky things going on with immutable classes (such as NSString, as opposed to the mutable NSMutableString) that are initialized with constants. All that funkiness is happening internally, behind the scenes. You should still call "release" on anything you "allocate".
    But if you are building objects from constants, you don't have to worry so much about which method is best. You can just pick the one you like to type the best. They are all identical in terms of efficiency. This may only be true for NSString as well, but that is a popular class.
    Try the following code:
    NSString * s1 = [NSString stringWithString: @"Testing"];
    NSString * s2 = [NSString stringWithString: @"Testing"];
    NSString * s3 = [NSString stringWithString: @"Testing"];
    NSLog(@"s1 value %p", s1);
    NSLog(@"s2 value %p", s2);
    NSLog(@"s3 value %p", s3);
    using any number of different ways to create the strings. Even call "copy" if you like. As long as you use NSString and initialize from a constant, your end result is always the same constant.

  • Is there a best way to create a uuid.

    Hi all,
    I'm a little bit confused about the right way to create unique objects ids, a way not depend on a database.
    There seems to be several approaches to do this:
    1.The class java.rmi.dcg.VMID states: 'A VMID is a identifier that is unique across all Java virtual machines.
    It generate a uuid which can be convertet to a String.
    2.The class net.jini.id.Uuid states: 'A 128-bit value to serve as a universally unique identifier. Two Uuids are equal if they have the same 128-bit value. Uuid instances can be created using the static methods of the UuidFactory class.
    3.The W3C org seems to have a guid generation.
    4.If you search the internet you will find several other implementations, like www.doomdark.org/doomdark/proj/jug/
    Why exist so many implementations of this feature?
    What is wrong with VMID?
    Klaus

    There was a question similar to this a little while
    back:
    http://forum.java.sun.com/thread.jsp?forum=4&thread=458
    77Mmm, but they werent able to produce any satisfying answere there either...
    Generating a true UUID is by nature plaform dependent, and should IMHO be implemented by the JRE/language libraries. Native code that is not a part of the JRE is always a problem, especially in J2EE environment. In addition, true uuids are useful in very many programming situations. Also, the random based versions are pretty dangerous, and can cause pretty nasty problems.

  • How do create CWAOWriteSpec object in Delphi?

    Hi,
    I'm using CWAO ActiveX control in Measurement Studio to do my delphi programming.
    I'm having problem in the CWAO.Write function. When I'm passing the write spec to the parameter, it will give me error, so I guess I may be create the CWAOWriteSpec object incorrectly. I have tried the method from http://digital.ni.com/public.nsf/3efedde4322fef19862567740067f3cc/2ff5b3cb556991b7862564b70071cdd6?OpenDocument but it doesn't work.
    I also tried following code:
    var
    WriteSpec: CWAOWriteSpec;
    begin
    WriteSpec := DAQTools.CreateCWAOWriteSpec;
    CWAO.Configure;
    CWAO.Write(Array, WriteSpec);
    CWAO.Start;
    end;
    I wonder is there any other ways to create CWAOWriteSpec object, beside the two methods above?
    Thank you,
    Donald Yeung
    Software Engineer
    Tensor Biosciences

    You can Use Transaction code: RSSM
    Check the following link
    http://www.sap-img.com/bc042.htm
    In SU20 you will have to create a CLass.
    After saving this double click this and you will taken to another screen where you can create Auth Object.
    You can create authorization fields in SU21 or use existing ones.
    You can also do above thru tcode SE80 Edit -> Other Object. In one the tabs you will see Auth. Objects .

Maybe you are looking for

  • , please help problem downloading apps since update

    Why can't i download apps since i updated to i06, i  log in with password .am then asked for three security questions fill this out click done and get the answer timed out try again, what is causing this please help.

  • Error while saving IT 0009

    Hi, I have entered Russia specific Bank key and account number and tried to save but I am getting an error messege by saying Bank account number contains invalid characters. actually the system should allow us to enter any account number. so please s

  • Problems calling LabVIEW VI through ActiveX inside another LabVIEW VI

    Hi everybody, basically I would like to create an ActiveX to be inserted in a LabVIEW VI which at its turn would call another LabVIEW VI. I have choosen Visual Basic to create this ActiveX, being the main section code: Dim lv As LabVIEW.Application D

  • IMovie - Poor Video Quality when exporting to "Projects"

    Hi - I'm using iMovie 11' and once I move my video (HD) from "Events" to "Projects" my video quality becomes very poor and the video is cropped. I have changed my setting to have it "fit frame" but the problem still exists. Thoughts?

  • E1000 wifi dead whenever I copy a large file between 2 PC's

    Whenever I try to copy a large file (eg. 200 MB) from one PC to another (both connected wirelessly to the Linksys E1000 router), the wifi on the router dies.  I can see the wifi indicator light on the router go off, and my PC's lose their connection