Dynamic typing in Java

Hi,
I keep reading that Java is predominantly a statically typed language, but with some added dynamic type checks at run-time.
What aspects of Java are dynamically typed?
Thanks

Try this little test, and then experiment some more.
class A {
  public void methA() {
    int i = 0;
    System.out.println("A.methA "+i);
class B  extends A {
  int i = 1;
  public void methA() {
    System.out.println("B.methA "+i);
public class AorB {
  public static void main(String[] args) {
    A a = new A();
    A ab = new B();
    B b = new B();
    a.methA();
    ab.methA();
    b.methA();
}

Similar Messages

  • How can i create an dynamic report in Java

    hello everybody,
    I want to make dynamic reports in Java. Report contain data and images with good layout.. such as crystal reports presentation..
    Reports fields decided at run time or we can say that it is generated according to user requirement...
    can it is possible in Java. If it is then which tool is better for it..
    please suggest me.. this is very urgent requirement for me...

    i don't know what types of tools are avaiable in market... Tools for what? You still didn't tell us what exactly you want to do.
    i just imagin that
    "An user create a database dynamically on server
    databaseNobody "dynamically creates a database".
    and he decide reports desgin according to
    his requirement..... we provide an control for this
    type possibilities....."
    so this is question is build in my mind.. so i
    forward this question to this forums..
    I am just going to check the physibility of my mind
    imagination...Feasibility you mean. IMHO, the feasibility of creating that stuff yourself is very low. Reinventing the wheel usually doesn't make it better, and it's likely to be more expensive to pay you for creating an inferior solution (not because of lack of skills, but simply because the available products had a few years time to grow, feature-wise) than to simply buy the licenses. Look at Crystal Reports or JFreeChart or Jasper Reports. Or use Google to look up J2EE-based reporting libraries. There might be more.
    Which of these is best, I don't know, I never used any of those. Also, the definition of "best" changes with the requirements. What's better, a Ferrari or a truck?

  • How to create dynamic images in java servlets?

    I want to create dynamic images in java servlet. Can servlet create dynamic images that based on the input data files? The results can be displayed in GIF, JPG..format? how can this be done? any example in internet?
    What OS do I need to install and what other requirements needed if i want to build up a servlet server?
    Thanks a lot!

    Also worth having a look at SVG http://www.w3.org/TR/2001/REC-SVG-20010904/, you can get a viewer at http://www.adobe.com/svg/ or you can use Batik http://xml.apache.org/batik/index.html to convert SVG to other formats such as JPEG.
    HH

  • Dynamic loading in Java

    I was asked following in the interview-
    What things are dynamically loaded in Java?
    How can we change this behaviour so as to load things statically?
    Can anybody clarify this for me or give some reference URLs etc?
    Thanks in advance.

    I was asked following in the interview-
    What things are dynamically loaded in Java?
    How can we change this behaviour so as to load things
    statically?
    Can anybody clarify this for me or give some reference
    URLs etc?
    Sounds like an absurdly general question to me.
    For example shared libraries are loaded dynamically. And there is no way to do it statically unless one modifies the jvm.
    Or using Class.forName() loads a class dynamically. Statically one could create a null reference which would be a 'static' load. Of course that is a rather tentative definition because java is still going to load it when the method is reached rather than on start up.
    Or one could say that the core jvm is statically loaded, for example the system class loader, since it is implemented in C (but of course it actually exists in a shared library so it is loaded dynamically as well by the OS.) All other classes are loaded dynamically and again it requires changing the JVM to alter the behavior.

  • Why objects are  dynamically created in java

    Why objects are dynamically created in java even if dynamically created object requires more space & more memory references as compared to static object?

    I don't even know where to start...
    KAMAL.MUKI wrote:
    Why objects are dynamically created in javaWhat is the alternative?
    even if dynamically created object requires more space & more memory referencesCan you prove that?
    as compared to static object?Can you define "static object"?
    I vote "troll".

  • Linklist and dynamic array in java?

    how to define linklist object and to build dynamic array in java?

    with so little information, all one can do is pointing you to :
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/LinkedList.html
    http://java.sun.com/j2se/1.5.0/docs/api/java/util/ArrayList.html

  • Dynamic FIle Name JAVA code

    Hi Guys,
    he requirement is to get File Name as XYZ.ddmmyyyy where as XYZ is constant.
    To achive this I am writing UDF in message mapping with dynamic configuaration below is the code:
    While I was trying to test end to end it is giving Runtime Exception in message mapping. please advice if this code needs correction?
    I have mapped as Source Main Node .....> UDF >  Target main node correct if it is wrong.
    DynamicConfiguration conf = (DynamicConfiguration) container.getTransformationParameters().get(StreamTransformationConstants.DYNAMIC_CONFIGURATION);
    DynamicConfigurationKey key = DynamicConfigurationKey.create("http://sap.com/xi/XI/System/File" , "FileName");
    DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
    Date date = new Date();
    String  filename =  "XYZ" + dateFormat.format(date);
    conf.put (key,filename);
    return null;   
    Thanks.

    Hi ,
         Please try replacing this line
    DateFormat dateFormat = new SimpleDateFormat("ddMMyyyy");
    with this line
    java.text.SimpleDateFormat dateFormat = new java.text.SimpleDateFormat("ddMMyyyy");
    Hope this solves your problem.
    regards
    Anupam

  • Dynamic Call to Java Class or Method

    Hi All,
    I have a requirement to call a Class or a Method Within the same class dynamically based on the user choice. I will give an example with how I do it in pl sql.
    begin
    if (choice = 1) then
    execute immediate 'package.procedure1(params)';
    elsif (choice = 2) then
    execute immediate 'package.procedure2(params)';
    else
    execute immediate 'package.procedure3(params)';
    end if;
    end;
    From the Example above, I call a program based on user choice. How Can I do the same in Java?
    Thank you.
    Edited by: Eric S. on Jul 6, 2011 9:52 AM

    I have a requirement to call a Class or a MethodYou can call a method, but not the Class where as you can instantiate the Class.
    I will give an example with how I do it in pl sql.
    begin
    if (choice = 1) then
    execute immediate 'package.procedure1(params)';
    elsif (choice = 2) then
    execute immediate 'package.procedure2(params)';
    else
    execute immediate 'package.procedure3(params)';
    end if;
    end;
    From the Example above, I call a program based on user choice. How Can I do the same in Java?The similar way. Here it takes the following structure.
    ClassA object = new ClassA();
    if(choice==1) {
          object.callMethod1();
    } else if(choice==2) {
          object.callMethod2();
    } else if(choice==3) {
          object.callMethod3();
    } Also you can switch case instead of if else. It takes the following structure.
    ClassA object = new ClassA();
    switch(choice) {
    case 1:  object.callMethod1(); break;
    case 2:  object.callMethod2(); break;
    case 3:  object.callMethod3(); break;
    }I recommend you to go with the second one which using switch.

  • How to declare a dynamic array in java

    I have to use a dynmic array of boolean and the size of this array will defiend throuh the run of the program to explian
    boolean[][] a;
    a=new boolean[number_of_ raw][number_of_ culm];
    after the program run the number_of_ raw and number_of_ culm will defind..so if any body know how to declare this kind of arraies in java please help me.

    My previous post gives me an idea on how to use ArrayList of ArrayList as dynamic 2 dimensional array.
    More info bellow
    ArrayList rows = new ArrayList()
    ArrayList columns_of_row0 = new ArrayList()
    rows.insertAt(0) = columns_of_row0;
    ArrayList columns_of_row1 = new ArrayList()
    rows.insertAt(1) = columns_of_row1;and so on..
    You can't use the code exactly or similar way, it would depend on how this array grows in your application.
    But this and my previous post should give an idea on how to insert and retrieve elements from ArrayList when
    treated as 2 dimensional array.
    Hope this helps.

  • PI 7.1 Access to Dynamic Configuration through Java Class

    My Current scenario involves IDCO -> FILE communications in PI 7.1 using XSL where the file name is dynamic.
    I have attempted calling a Java Class from XSL with the use SAPXMLTOOL kit option set in the adaptor and it works but I need to be able to call the transform method
    public void transform(TransformationInput arg0, TransformationOutput arg1)
    from XSL so I can access the message and update the File Name via Dynamic Configuration.
    Whilst I can call a static class with in the object I can not call transform with the correct arguments (arg0, arg1). I need access to arg0 (payload) to set/figure out the filename. I can calculate the filename in XSL and pass it to the Java but in a static method it is useless as it need to access the arg0 which is a object and obviously non-static context.
    Is this possible ? How do I get access to Dynamic Configuration from XSL through Java in 7.1 ?
    I have successfully called a static method but that is no help.
    Thanks in advance.

    Suraj,
       Unfortunately you link isnt operational but thankyou anyway, I have managed to call as Java class as per my original post, but a static method does not allow me to get a handle to the Dynamic Configuration Variables in the message.
    It seems importing the 7.0 LIBS may be an option and Im not entirely sure I have that option.
    It certainly isnt possible to use the JDK5 XML implementation to even call a static method on an Java OBJ from XSL (obviously the USE SAPXMLTOOLKIT option is there for a reason).
    I think and again I could be wrong but direct access via XSLT..
    LINK:http://help.sap.com/saphelp_nwpi71/helpdata/EN/e2/e13fcd80fe47768df001a558ed10b6/frameset.htm
    Is what Im looking for, I shall report back success or failure but the doco seems to fit the bill. Im not sure why I wanted to instatiate a sperate Java class when it can all exist in the XSLT.

  • Dynamic Reports in java application

    Hi,
    I want to create dynamic reports in an java standalone application, I have downloaded the Jfreereport <http://sourceforge.net/projects/jfreereport>
    I'm not sure, whether it could get data from a JDBC source. (or is there anyother solution to generate dynamic reports in a java application?).
    Thanks in advance,
    Payam

    I generate reports from a webserver ( Tomcat ) in PDF using iText ( www.lowagie.com/iText ). It works great. JFreereport is also using this iText and you shouldn't have any problems using JDBC. Try to read the tutorial first about iText first. This will give you an idea how JFreereport works.
    - Dieter

  • How to create dynamic variable in Java?

    Hi,
    I want to create dynamic varible , using ArrayList or Vector. The number of array i dont knwo, so how to create dynamic ArrayList or Vector.
    for example:
    ArrayList1,ArrayList2,ArrayList3.....n
    or
    Vector1,Vector2,Vector3 .....n, the n value i will get at run time, so how to create the dynamic ArrayList or Vector or i can use any other Object in java,
    Pls provide your input.
    Sridhar

    1. I have a HashMap with dataok ... fair enough.
    2. depending on its size, i need to create variable
    to store them.uhm ... why? If you have a variable number of elements in the map then you'd need to generate a variable number of variables (a number, that is not know at compile time, as it seems). Now if you could somehow create those variables, how would you access them? You'd have to generate the code handling them as well ...
    Tell us what kind of data you've got and what you want to do with it. There's certainly a better solution to your problem.
    how to generate variables as per content size of the
    HashMapYou don't.

  • Can I balloon engineering prints in Adobe Reader or Acrobat? Create a dynamic stamp w/ Java Script?

    I am trying to establish a very simple way to balloon prints with character numbers; below I have uploaded an example screen shot.  My end goal is for the user to select a dynamic stamp (a circle with a number in the center) and it start numbering with 1 and then increment by 1 yet the user is placing each balloon in its respective location, resetting for each PDF document, one addition would be to allow the balloon numbers to be edited like a text box after they have been created in case there is an error in balloon placement etc.  Is this possible? I have programming experience in other languages, but have only built a few dynamic stamps with time stamp information provided by java script code.
    Any assistance is greatly appreciated!

    Yes it's possible with dynamic stamps, but the code is rather messy as it has to keep a running total.
    See http://www.pdfscripting.com/public/department53.cfm for some samples (and the definitive book on creating your own dynamic stamps), and Rick Borstein's blog for some basic samples that put exhibit numbers on legal documents.

  • Dynamic reporting in Java

    Hi to all
    I want to create a dynamic reporting tool , in which user can add & delete no of columns from database table and for selected columns , user want to generate reports. Can any one give me idea about Java API or any other API that we can use in java application for dynamic reporting. Please give me reference example for suggested API if possible. I shall be very thankfull for your support & guidence.
    Preet

    socmag_Java_developer wrote:
    I want to create my own GUI reporting tool in java. Can you suggest me any Java API with some examplesIf you mean "*Standard* Java API", don't you find suggestions and examples in the first answer?

  • Two questions on dynamic parameter from java API point of view

    Hi,
    We have a requirement for dynamic parameters in crystal reports that need to be executed in java application. Since, crystal java framework do not support the dynamic parameter execution (please correct me if I am wrong), we plan to execute explicitly the query for getting the dynamic values of such dynamic parameters before listing the parameters in java application.
    The query for the dynamic parameter will be given in the field 'Prompt Group Text' of the parameter.
    I coudl not get hold of these details from java api. So please some one help me out.
    Environment - Crystal X1 R2 with java libraries
    1. How can we identify a parameter is a dynamic one?
    2. How to get the 'Prompt Group Text' field value?
    Any suggestions welcome.
    Thanks,
    Ratan.

    There are these two methods in the Business Objects Enterprise SDK Developer Libary:
    byte[]   getDynamicCascadePromptData()
               Returns a collection that contains dynamic cascading prompt data. 
    java.lang.String getDynamicCascadePromptGroupID()
                            Returns a dynamic cascade prompt group ID. 
    For more information on what is available through available SDK's, please refer to the following link:
    http://devlibrary.businessobjects.com/BusinessObjectsXIR2SP2/en/devsuite.htm

Maybe you are looking for