Why java is strongly typed language

Can any one help me to answer the following query:
(1)why java is strongly typed language?

Can any one help me to answer the following query:
(1)why java is strongly typed language?http://en.wikipedia.org/wiki/Strongly-typed_programming_language

Similar Messages

  • Why Java? Why not C++ ?

    Hi
    This question has probably been asked here before. I am new to this forum, as well as to Java: actually, I'm trying to decide if it's worth learning. I do know C++, but have not worked with it for several years now (I am not in the software profession in the true sense of the word).
    My understanding is that Java is some sort of 'safer' version of C++, without several C++ features. Some of Java's shortcomings relative to numerical computation, for example, are itemized here: http://math.nist.gov/javanumerics/reports/jgfnwg-01.html. I'm sure C++ has its own list of shortcomings, but it seems a very powerful language. I understand that C++ can be 'dangerous', but presumably its 'dangerous' aspects can be avoided by the inexperienced programmer (I am not trying to be snobby here... I have several years of programming experience, but it dates back quite a while).
    Java is very popular for creating web applets (it may very well be the only language that allows this... presumably, this is determined by browser technology). I am slightly peeved at having to learn another OOP language only to be able to write applets. Had anyone ever thought of implementing a 'C++ virtual machine'? Was the task considered too complex? What marketing factors were present?
    I am writing this partly because I must now learn yet another OOP...Object Oriented Pascal... (at least its rudiments) because I'm using a RAD tool (Lazarus) at work... sigh. This is another case of "tool-driven language learning"...
    I currently work in a hardware-language environment. It's curious to note that Pascal has its roots in ALGOL, as does VHDL. I would liken Java & OOPascal to VHDL, which is a very strongly typed language and has other 'safe' features (along with often frustrating limitations); and C++ to Verilog, which is very flexible and hence considered 'dangerous'.

    Hi
    This question has probably been asked here before. I
    am new to this forum, as well as to Java: actually,
    I'm trying to decide if it's worth learning. I do
    know C++, but have not worked with it for several
    years now (I am not in the software profession in the
    true sense of the word).
    My understanding is that Java is some sort of 'safer'
    version of C++, without several C++ features. Some of
    Java's shortcomings relative to numerical
    computation, for example, are itemized here:
    http://math.nist.gov/javanumerics/reports/jgfnwg-01.ht
    ml. I'm sure C++ has its own list of shortcomings,
    but it seems a very powerful language. I understand
    that C++ can be 'dangerous', but presumably its
    'dangerous' aspects can be avoided by the
    inexperienced programmer (I am not trying to be
    snobby here... I have several years of programming
    experience, but it dates back quite a while).The alleged dangers of C++ are manageable.
    Java is very popular for creating web applets (it may
    very well be the only language that allows this...
    presumably, this is determined by browser
    technology). I'd say that applets are one of the least important features of Java. You've been reading too much stuff from 1998.
    I am slightly peeved at having to learn
    another OOP language only to be able to write
    applets. This is an ignorant statement. That's not why you should learn Java.
    Had anyone ever thought of implementing a
    'C++ virtual machine'? Was the task considered too
    complex? What marketing factors were present?Why? What does that buy you?
    ANSI C++ is pretty portable stuff. You can compile and run it on any machine that has an ANSI C++ compiler, and the list is long.
    Language extensions (e.g., Microsoft enhancements) are what keep C++ from being portable.
    I am writing this partly because I must now learn yet
    another OOP...Object Oriented Pascal... (at least its
    rudiments) because I'm using a RAD tool (Lazarus) at
    work... sigh. This is another case of "tool-driven
    language learning"...So why are you are asking about Java if you're learning Object Pascal?
    I currently work in a hardware-language environment.
    It's curious to note that Pascal has its roots in
    ALGOL, as does VHDL. I would liken Java & OOPascal to
    VHDL, which is a very strongly typed language and has
    other 'safe' features (along with often frustrating
    limitations); and C++ to Verilog, which is very
    flexible and hence considered 'dangerous'.Don't be so afraid. C++ is the predecessor of Java, so they are pretty similar. There are bits that were taken out of and added to Java based on lessons learned, but C++/Java/C# can be considered to be in the same family of languages.
    %

  • Why java is called as true object oriented language?

    HI Friends,
    Though few oops concepts is not supported , why java is called as truly object oriented language and C++ as not a purely object oriented language???? Please, if any one know , give me the answer.
    Thanks to all.

    few oops concepts is not supportedwhich concepts?
    as far as i know...to be OO, you must supports
    encapsulation, abstraction, inheritancxe, composition (aggretration, et all) and polymorphism. Java supports all those comcept..now..Java is a hybrid due to what Jverd has pointed out.
    the only pure OO language that i know of is SmallTalk. they have Meta class that can create Class object. and all their primitaives are object.
    C# comes close, but their Class are not object.

  • Why java file name and class name are equal

    could u explain why java file name and class name are equal in java

    The relevant section of the JLS (?7.6):
    When packages are stored in a file system (?7.2.1), the host system may choose to enforce the restriction that it is a compile-time error if a type is not found in a file under a name composed of the type name plus an extension (such as .java or .jav) if either of the following is true:
    * The type is referred to by code in other compilation units of the package in which the type is declared.
    * The type is declared public (and therefore is potentially accessible from code in other packages).
    This restriction implies that there must be at most one such type per compilation unit. This restriction makes it easy for a compiler for the Java programming language or an implementation of the Java virtual machine to find a named class within a package; for example, the source code for a public type wet.sprocket.Toad would be found in a file Toad.java in the directory wet/sprocket, and the corresponding object code would be found in the file Toad.class in the same directory.
    When packages are stored in a database (?7.2.2), the host system must not impose such restrictions. In practice, many programmers choose to put each class or interface type in its own compilation unit, whether or not it is public or is referred to by code in other compilation units.

  • Weak and Strongly Typed Reference Cursors in Reports

    Our custom reports has been using a reference cursor. I have inherited the code and not sure why there is a need to use a reference cursor when it can be done by a simple select statements. I see no dynamic select statements passed or any special parameters to reason out for use of reference cursor in our custom reports. Prior developers had reason out the benefits of using reference cursor for performance. I tested this by running a report with reference cursor versus plain select statement and still the report that is using the plain select statement performed better (faster) than the report that has the reference cursor, there is a big difference.
    I have seen some disadvantage of using reference cursor on the reports that when there is a database object change even if the package that sourced the reference cursor has not been updated or modified the reports needs to be recompiled each time we get this error message coming from the report server queue:
      Terminated with error: <br>REP-8: Run time error in the PL/SQL development
      environment (DE). PDE-PSD001 Could not resolve reference to <Unknown Program Unit>
      while loading <Unknown> <Unknown>. REP-0008: Unexpected memory error while
      initializing preferences.In 9iAS reports prior version the error is occurring rarely. When we moved to 10.1.2.2.0 reports it appears the error occurs most often. We have made an effort to research about the issue and appears to be a bug. One suggestion is to use a strongly typed reference cursor. I have tried to researched about the difference between a weak and strongly typed reference cursor but failed to understand them. I appreciate any help about examples differentiating a weak versus a strongly typed reference cursors.
    Thanks,
    Warren

    I guess my point, for what it's worth, is that whether you use only a strongly typed REF CURSOR, or whether you also use a weakly typed REF CURSOR, you may still end up getting the REP-0008 error (at least if your report is in .REP format). You can avoid this by using a pipelined function instead (or by putting the SQL directly in the report, or possibly by using .RDF or .JSP format).
    To test this, you might:
    1. Create a database package with an SQL*Plus script that that looks something like this:
    CREATE OR REPLACE PACKAGE TEST AS
        TYPE RECORD_TYPE IS RECORD
            USERNAME ALL_USERS.USERNAME%TYPE
        TYPE TABLE_TYPE IS TABLE OF RECORD_TYPE;
        TYPE WEAKLY_TYPED_REF_CURSOR_TYPE IS REF CURSOR;
        TYPE STRONGLY_TYPED_REF_CURSOR_TYPE IS REF CURSOR RETURN RECORD_TYPE;
        FUNCTION GET_WEAKLY_TYPED_REF_CURSOR RETURN WEAKLY_TYPED_REF_CURSOR_TYPE;
        FUNCTION GET_STRONGLY_TYPED_REF_CURSOR RETURN STRONGLY_TYPED_REF_CURSOR_TYPE;
        FUNCTION GET_PIPELINED_TABLE RETURN TABLE_TYPE PIPELINED;
    END TEST;
    CREATE OR REPLACE PACKAGE BODY TEST AS
        FUNCTION GET_WEAKLY_TYPED_REF_CURSOR RETURN WEAKLY_TYPED_REF_CURSOR_TYPE
        IS
            cWeaklyTypedRefCursor WEAKLY_TYPED_REF_CURSOR_TYPE;
        BEGIN
            OPEN cWeaklyTypedRefCursor FOR
            SELECT USERNAME FROM ALL_USERS;
            RETURN cWeaklyTypedRefCursor;
        END GET_WEAKLY_TYPED_REF_CURSOR;
        FUNCTION GET_STRONGLY_TYPED_REF_CURSOR RETURN STRONGLY_TYPED_REF_CURSOR_TYPE
        IS
            cStronglyyTypedRefCursor WEAKLY_TYPED_REF_CURSOR_TYPE;
        BEGIN
            OPEN cStronglyyTypedRefCursor FOR
            SELECT USERNAME FROM ALL_USERS;
            RETURN cStronglyyTypedRefCursor;
        END GET_STRONGLY_TYPED_REF_CURSOR;
        FUNCTION GET_PIPELINED_TABLE
        RETURN TABLE_TYPE PIPELINED
        IS
        BEGIN
            FOR rec IN
                SELECT USERNAME FROM ALL_USERS
            LOOP
                PIPE ROW(rec);
            END LOOP;
        END GET_PIPELINED_TABLE;
    END TEST;
    /2. Create a report based on REF CURSOR query using only a strongly typed REF CURSOR. The PL/SQL statement that you use in the report as the data source for the query might look something like this:
    function QR_1RefCurDS return test.strongly_typed_ref_cursor_type is
    begin
      return test.get_strongly_typed_ref_cursor;
    end;3. Compile the report to a .REP file and run it to make sure it works as expected.
    4. Drop and re-create the TEST package in the database.
    5. Try running the .REP file again. I expect you will get the REP-0008 error.
    6. Modify the REF CURSOR query to use an underlying weakly typed REF CURSOR by changing the PL/SQL statement (from Step 2) to something like this:
    function QR_1RefCurDS return test.strongly_typed_ref_cursor_type is
    begin
      return test.get_weakly_typed_ref_cursor;
    end;7. Repeat Steps 3 through 5. I expect you will get the REP-0008 error again.
    8. Replace the REF CURSOR query in report with an SQL query that looks something like this:
    SELECT * FROM TABLE(TEST.GET_PIPELINED_TABLE)9. Repeat Steps 3 through 5. I expect you will not get the REP-0008 error.
    Hope this helps.

  • Why java is free?

    I don't understand why java technology is free to download, and even more of this, the source code is available.
    I think sun can make a lot of money from us. (without giving ideas)

    They're trying mic$ofts trick - for years micro$oft offered wondoze on easy to copy disks, with little or no security (even though they could have implemented some kind) knowing that people would pirate it, and spread it around very quickly. Then, when most of the computing world is hooked on using windoze, they upgrade to a flashy secure version that you have to pay loads for. It was a gamble, but certainly paid off. What sun are doing is the only possible tactic for them at the moment, which is to spread java as much as possible to ensure loads of people use it - they are not doing this for fun, or the love of the language, but purley and simply as a business strategy.

  • Why Java is  following Unicode & not ASCII standard?

    Hi all,
    I am new to Java as well as to this forum.
    Could you please tell me why Java is not following ASCII format?
    And why is it following Unicode?
    Thanks,
    Reni

    Unicode is chosen because it's an abbreviation for Unique Ode, which means that it provides a special sort of poetry to give Java an aura of mystique, intelligence and worldliness that sets it apart from other languages.
    To support languages and characters other than English.Who doesn't read/speak English, really?! And why isn't there multiple language keywords for Java. Why can't I write code en Espa?ol?
    p?blico vac?o hagaAlgo(Secuencia s) {
       para(nent i = 0; i < s.longitud(); i++) {
          Sistema.fuera.impresi?nL?nea(i + " = " + s.car?cterEn(i));
    }(int abreviated for "n?mero entero")
    Message was edited by:
    bsampieri

  • Why java is very secure

    tell the reasons why java is very secure compare than other languages

    s.s.s.s wrote:
    tell the reasons why java is very secure compare than other languagesIts not, security is not determined by the language or platform. Sure Java provides the tools to implement a secure environment, and I'd hesitate to say that Java is among the easier platforms to get solid security setup. But it still depends on one major factor if it is ever going to happen: you.

  • Why java take enum type off

    why java take enum type off?
    When in switch statement, it become complex without enum type.
    Enum can constrained the range of integer value. Taking enum type off,
    method parameter checking will take lots effort.
    can any way to replace the functions of enum type.

    It was a disputable design decision.
    The original C "enum" type is however somewhat flawy from its lack of encapsulation (its elements "pollute the global namespace" - they are for this purpose!) and would not seamless fit into the typed, OO Java philosophy.
    Otherwise put, the original "C" enum fits well to the C philosophy but no to the C++ or Java one.

  • Why java does not support multiple inheritance ???

    Hai friends ..iam new to java .. i have doubt ..plz help me
    Why java does not support multiple inheritance ???

    The reasons for omitting multiple inheritance from the Java language mostly stem from the "simple, object oriented, and familiar" goal.
    To understand multiple inheritance, the learner needs some level of expertise like virtual derivations etc in c++. Multiple inheritance will allow method duplication, and throws the learner into confusion which method might be called by the compiler in which scenario at run time.
    Even though this answer seems to be funny, this is the actual reason why java omitted multiple inheritance of classes.
    But java support multiple inheritance of interfaces. Multiple interface inheritance allows an object to inherit many different method signatures with the caveat that the inheriting object must implement those inherited methods.

  • Strongly typed collection w genertics

    I just started looking at the new features of 1.5, and generics specifically.
    My question is, can I create a strongly typed collection using generics.
    Assuming I have a java object call Car and want to have a collections of cars. I could do:
    ArrayList cars = new ArrayList<Cars>();But what I would rather do is have the generic done within the collection class so that I just call:
    CarCollection cars = new CarCollection();Thanks

    Are you sure a Collection of Cars should know how to
    get the total horsepower. Now it sounds like there
    should be some other class that has a collection of
    cars. Most (and by that I mean all with a few
    exceptions) applications should never need a class
    that extends a Collection class.
    Most (and by that I mean all with a few
    exceptions) applications should never need a class
    that extends a Collection class.You cannot say that generally. Especially if you like the functional style of programming there are lots of nice things you can do with lists.
    What's wrong with having a ListOfCars class offering operations on car collections as a whole? Like summing up this or that, or returning a new list according to a selection criterium, etcetera. Either the list itself does this or it offers a set of functors and filters you can apply.
    A ListOfCars class represents a composite relationship. This doesn't mean it has to be implemented using composition (has-a). Design and implementation are separate things.

  • Does java have strong names?

    Hi,
    I am a .net developer also interested in Java. I would like to know if Java provides something similar to Strong names in .net.
    Thank you.

    I have another question, pls guys dont mind about posting it in the same thread. I did not want to clutter the forum.
    If I have two interfaces like this:
    Interface A{
    void getMethod();
    Interface B{
    void getMethod();
    If I have a class implementing these two interfaces:
    Class C implements A,B{
    //I will not be able to give implementation for both the methods in java here
    But I can do it in .net. I do not understand why java does not provide this or what is the advantage of having it in .net?
    I can do it in .net like this:
    the two interfaces would be like this:
    Public Interface a
    Sub getMethod()
    End Interface
    Public Interface b
    Sub getMethod()
    End Interface
    the class can implements bot these interfaces with the same method signature:
    Public Class c
    Implements a, b
    Public Sub agetMethod() Implements a.getMethod
    End Sub
    Public Sub bgetMethod() Implements b.getMethod
    End Sub
    End Class
    I can write a class which can invoke the specific methods without ambiguity:
    Public Class k
    Public Sub New()
    Dim atmp As a = New c()
    Dim btmp As b = New c()
    atmp.getMethod()
    btmp.getMethod()
    End Sub
    End Class
    If I want to do it in java, how do I do it? please educate me on this.
    Thank you.

  • Using a strongly typed ref cursor doesn't enforce data type

    I am trying to enforce the datatypes of the fields coming back from an oracle reference cursor by making it strongly typed. However, there seems to be no warning at compile time on the oracle side or exception in ODP.NET if the datatype coming back in the cursor does not match. For example here is my cursor and proc
    create or replace
    PACKAGE THIRDPARTY AS
    type pricing_record is record
    BaseIndexRate     number(6,5),
    BaseIndexRateType     VARCHAR2(1 BYTE)
    type cur_pricing2 IS ref CURSOR return pricing_record;
    PROCEDURE getpricingbyappidtest(appid IN application.intid%TYPE, pricing OUT cur_pricing2);
    END THIRDPARTY;
    create or replace
    PACKAGE BODY THIRDPARTY AS
    PROCEDURE getpricingbyappidtest(appid IN application.appid%TYPE, pricing OUT cur_pricing2)
    AS
    BEGIN
         OPEN pricing FOR
         SELECT      somevarcharfield, someothervarcharfield
    FROM application
    WHERE A.appid = appid;
    END getpricingbyappidtest;
    I would expect this wouldn't compile since i am putting a varchar into a number field. But it does. Also if i check the datatype in the reader on the .net side it also is a string. So odp doesn't seem to care what type the cursor is
    here is that code and output
    var schemaTable = reader.GetSchemaTable();
    using (var file = new System.IO.StreamWriter("c:\\_DefinitionMap_" + cursorName + ".txt"))
    file.WriteLine("COLUMN" + "\t" + "DATATYPE");
    foreach (DataRow myField in schemaTable.Rows)
    file.WriteLine(myField["ColumnName"] + "\t" + myField["DataType"]);
    COLUMN     DATATYPE
    BaseIndexRate     System.String
    BaseIndexRateType     System.String
    Does anyone have an approach for enforcing datatypes in a ref cursor? Am I doing something wrong when defining the ref cursor?

    Hello,
    By using a ref cursor you are really using a pointer to a cursor. There is no way I know of to make a compile check of the cursor check unless you want to create a SQL type and cast the cursor to this type and even this wouldn't work in all cases. For instance, I could have function call within my cursor select which could return a varchar (with a number always in the varchar) which would be horribly sloppy but legal and you would expect Oracle to compile it.
    If you are worried about this I would suggest not using ref cursors and go to UDT instead, where there will be more checking (because of a C# equivalence generated object). Oh and BTW, yes the cursor will throw an exception if the data is incorrect, but only at runtime - just like normal Oracle PLSQL.
    Cheers
    Rob.
    http://www.scnet.com.au

  • Why do I have multi language versions in other system....

    Hi All,
    Could you let me know why do I have multi languages versions when I transported the form to other sandbox system.
    Let me breif my probem. On development system I have one form and since we do not want other languages versions to come into picture so I deleted all of the languages versions and kept only original version which is 'DE' in which form was created. When i see the version logs it also shows me only 'DE' version since I deleted rest of other versions.
    On development system form works fine since we want language 'DE' to be called for any language and inside the form it takes care for all the languages.
    But when I transported it to other sandbox system form is not working fine since when transported it is now available in all the languages and when testing is done for this form in sandbox system it does not work since for example when testing is done using 'HU' language form gets called in 'HU' language and  it is available on sandbox system and as a result form does not work since in 'HU' language form is not correct, and also when versions are seen on sandbox it shows the form active or translate in all the languages.
    Is there anything that needs to be done while transporting the form...I only want that on sandbox system only version DE should be available..like the way it is in development system.
    Thanks,
    Mark

    Hi All,
    Can some one give me a clue as to why I am having this problem.
    Thanks,
    Mark

  • Why Java Web Start doesn't support Pack200 out-of-the-box?

    Hello All,
    Why Java Web Start doesn't support Pack200 out-of-the-box? I was hoping that Java 6 would make things easier by adding direct support for Pack200 in Java Web Start and JNLP without needing to use servlets, etc.? All my clients are Java 5 or above so I can't push the Pack200 compressed version of the jar to every single one of them and there is no selection process needed. But I can't do it because of the servlet or complex Apache server setup requirement (it would be a headache to get customers' web server admins to set up Apache or whatever web server that way).
    My question is why is there unwillingness to add Pack200 support directly to Java Web Start and JNLP so that you can start Pack200 compressed jars just like you would start any jar using Java Web Start? Is te a technical problem?
    Thank you,
    Mete Kural

    Hallo,
    I didn�t try it, but the webstart FAQ�s read:
    Can I use Pack200 compression with the JnlpDownloadServlet?
    Yes. The JnlpDownloadServlet distributed in the samples directory of the JDK now supports Pack200. If you deploy yourfile.jar along with yourfile.jar.pack.gz the packed file will be downloaded when the client is running Java Web Start 1.5.0 or later.
    http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/faq.html#217
    For further information you may want to look at
    http://java.sun.com/javase/6/docs/technotes/guides/javaws/developersguide/downloadservletguide.html#pack200
    The configuration of the server and the the servlet (as described in the second link) is as easy as it seems.
    I got it working on the first try and it was my first experience with websevers at all.
    Bye Schippe
    Message was edited by:
    Schippe

Maybe you are looking for

  • Oracle EPM 11.1.2.2 installer bug

    Hello, Anyone found a problem with the installer for EPM 11.1.2.2 where if you go back into installtool.cmd after an install and try to add another product. The new product gets installed but the inventory and Comps.xml files get corrupted and some a

  • Problem with home button and "messages" app after upgrade to iOS 4.1

    Hello, I have noticed two interesting problems with my iPhone 4. I am not sure if it is in conjunction with the upgrade to the iOS 4.1 software, but I did not notice the problem prior to this. Both of these problems are very odd and are hit or miss.

  • Upload an excel file to update a table

    Hi All I have a requirement in which, user uploads a simple excel file with some records (columns in excel in a pre-specified format similar to a database table) and all those have to insert into a table in a database. I've gone thru some documentati

  • Is the new macbook pro with retina display available now in apple retail stores?

    Is the new macbook pro with retina display available now in apple retail stores? im going to miami tomorrow and staying there till the 27 of june and I want to buy one but dont know were...

  • Transfer errors when using Napster to Go servi

    Recently napster have updated their software and now all of a sudden i am getting transfer errors when i try putting track on my creative zen micro photo 8gb. Has anybody else been experiencing this? I wondered whether its a napster issue or whether