Clarifications/Suggestions in Java

1> I have a Employee class with six employee objects{e1,e2,e3,e4,e5,e6} added to it.How do i sort it using Tree Set ?Code example please
2> What is load factor in HashMap.?
3> Can i subclass a singleton class ?
4> what is lazy loading of Servlets ?
5> how do you intialize a session in Servlets ?
6>what is the pros and cons os using jsp:use bean tag
7> give an example where you can use DynaActionForm.Code example please                                                                                         Please help

1> I have a Employee class with six employee objects{e1,e2,e3,e4,e5,e6} added to it.How do i sort it using Tree Set ?
Employee e1 = new Employee();
Employee e2 = new Employee();
Employee e3 = new Employee();
Employee e4 = new Employee();
Employee e5 = new Employee();
Employee e6 = new Employee();
SortedSet s = Collections.synchronizedSortedSet(new TreeSet(...)); // i dont know how to proceed at this step.Please help me now.2> What is load factor in HashMap.?
An instance of HashMap has two parameters that affect its performance: initial capacity and load factor. The capacity is the number of buckets in the hash table, and the initial capacity is simply the capacity at the time the hash table is created. The load factor is a measure of how full the hash table is allowed to get before its capacity is automatically increased. When the number of entries in the hash table exceeds the product of the load factor and the current capacity, the hash table is rehashed (that is, internal data structures are rebuilt) so that the hash table has approximately twice the number of buckets.
As a general rule, the default load factor (.75) offers a good tradeoff between time and space costs. Higher values decrease the space overhead but increase the lookup cost (reflected in most of the operations of the HashMap class, including get and put). The expected number of entries in the map and its load factor should be taken into account when setting its initial capacity, so as to minimize the number of rehash operations. If the initial capacity is greater than the maximum number of entries divided by the load factor, no rehash operations will ever occur. 3> Can i subclass a singleton class ?
I have not tried but i *think* we cannot subclass a singleton class.Need example for this .
4> what is lazy loading of Servlets ?
A container doesnot initialize the servlets as soon as it starts up, it initializes a servlet when it receives a request for that servlet first time. This is called lazy loading. The servlet specification defines the <load-on-startup> element, which can be specified in the deployment descriptor to make the servlet container load and initialize the servlet as soon as it starts up. The process of loading a servlet before any request comes in is called preloading or preinitializing a servlet.5> how do you intialize a session in Servlets ?
  HttpSession session  = request.getSession(); //please correct me if im wrong. 6> give an example where you can use DynaActionForm --> Please help me with this..

Similar Messages

  • Anybody suggest a java project using network concepts

    i am in need of suggestion of a project in network using java
    please help

    But be advised that it may make your McBoss upset, and
    damage your chance of making head fry-boy.That gives me an idea for a screenplay
    McWorker: Hey there McBoss, can you suggest a job for me to do?
    McBoss: Why yes I can McWorker, you can handle the register.
    McWorker: Ouch, that's a little too complicated for me, anything simpler?
    McBoss: Hmm, how bout you make fries.
    McWorker: Nope, simpler.
    McBoss: Mop up, take out the garbage?
    McWorker: Too hard, way too hard.
    McBoss: Um, stand there and do nothing?
    McWorker: Done and done!
    McBoss: Great, anything else?
    McWorker: Ya, when do I get paid?
    <End Scene>

  • Some Pogo games won't load. EA Games suggested Lion Java update but it didn't help.

    After updating my 10.6 OS  to Lion, I cannot open many of the Pogo games I previously played. EA games ( in Pogo help ) suggested using apple's Java update for Lion. Installing the update did not correct the problem.  Is there anything else I can do to get pinochle, canasta and other games in Pogo to load?

    I have the same problem with connection reset. For awhile I couldn't even bring up pogo home page. I thought it was the ad blocker, but after allowing pogo site on ad blocker, the problem continues. I too am really frustrated with this; everything was fine until I updated Firefox. My solution was to download Google Chrome. Pogo works just fine on that. I still want my Firefox back! Any solutions out there?

  • Suggestions on java frameworks

    I'm interested in a learning a java web development framework and I'm looking for some recommendations/suggestions on which one I should learn.
    Ideally, I'd like the framework to:
    1. Be MVC based.
    2. Have minimal if any configuration
    3. Have an easy to use ORM
    4. Have Decent session management
    5. Be easy to pickup
    I'm familiar with pylons and django so if there's a java framework similar to either one of those then I'd be interested in it.
    Thanks.

    try struts or spring (you can use spring along with struts or alone )

  • Suggestion on Java Book

    Hi! I studied Java about 2-3 yrs ago and I just need to refresh my memory about the language so does anyone have suggestions about which book to buy? I just need a Java book that would refresh my memory and if possible, update me on the latest information and news about java. Thank you very much!

    i think he means that a lot of people have asked the same question before, and you should do a search on the forums for an answer.
    But really, if you're looking for a good book you can't go past Core Java 2 (Vol 1 & 2), by Horstmann and Cornell, from the Sun Microsystems Press. Vol 1 covers all the fundamentals and is a great reference. Vol 2 goes into more detail on advanced topics: multithreading, networking, advanced swing and awt etc, both come with a CD that has heaps of code samples.
    They are a bit expensive (over $Aus 100 each) but more than worth it.

  • Who can give me a suggestion about java crash with Internal Error ID?

    I running my server performance test, but after 7 hours, the jvm crashed and give a java internal error ID with "*53484152454432554E54494D450E43505001A8*",
    and I can not query any valuable information from Google by this internal Error ID. Who can give me a light?
    I have run the performance test on the other machine with the same service logic, the other environment not crash, It's very strange!
    h5. some content of The hs_err_xxx.log file:
    # An unexpected error has been detected by HotSpot Virtual Machine:
    # Internal Error (53484152454432554E54494D450E43505001A8), pid=16908, tid=1060293520
    # Java VM: Java HotSpot(TM) Server VM (1.5.0_19-b02 mixed mode)
    --------------- T H R E A D ---------------
    Current thread (0x425782e8): JavaThread "11d1def534ea1be0:656f6049:124caa54ac8:49c0,EventTypeID[com.telware.protocol.cid.eve
    nt.CIDContinueEvent#telware#1.0], #14" [_thread_in_Java, id=17068]
    Stack: [0x3f2ac000,0x3f32d000), sp=0x3f32b2a0, free space=508k
    Native frames: (J=compiled Java code, j=interpreted, Vv=VM code, C=native code)
    V [libjvm.so+0x516863]
    V [libjvm.so+0x1ca6cc]
    V [libjvm.so+0x4a3c5f]
    V [libjvm.so+0x43ceb6]
    V [libjvm.so+0x43a0c4]
    Other Threads:
    0x08e0d850 VMThread [id=16914]
    0x08e20e20 WatcherThread [id=16923]
    VM state:not at safepoint (normal execution)
    VM Mutex/Monitor currently owned by a thread: None
    h6. Heap
    par new generation total 98304K, used 36214K [0x49360000, 0x51360000, 0x51360000)
    eden space 65536K, 29% used [0x49360000, 0x4a667c10, 0x4d360000)
    from space 32768K, 51% used [0x4d360000, 0x4e3b5e58, 0x4f360000)
    to space 32768K, 0% used [0x4f360000, 0x4f360000, 0x51360000)
    concurrent mark-sweep generation total 1507328K, used 974545K [0x51360000, 0xad360000, 0xad360000)
    concurrent-mark-sweep perm gen total 40152K, used 24021K [0xad360000, 0xafa96000, 0xb1360000)
    h6. VM Arguments:
    jvm_args: -Dfile.encoding=utf-8 -verbose:gc -XX:+PrintGCDetails -XX:+PrintGCTimeStamps -XX:+PrintGCApplicationConcurrentTime
    -XX:+PrintGCApplicationStoppedTime -Xloggc:/home/sepcs/sep/oper/gc.log -Xms1600m -Xmx1600m -Xmn128m -XX:SurvivorRatio=2 -XX:+
    UseFastAccessorMethods -XX:-UseFastEmptyMethods -XX:+UseFastJNIAccessors -XX:ParallelGCThreads=2 -XX:+UseConcMarkSweepGC -XX:
    UseParNewGC -XX:CMSFullGCsBeforeCompaction=1 -XX:GCTimeRatio=19 -Xnoclassgc -XX:DisableExplicitGC -XX:CMSInitiatingOccupanc
    yFraction=70 -XX:+UseCMSCompactAtFullCollection -XX:+CMSParallelRemarkEnabled -Dsep.home.dir=/home/sepcs/sep
    java_command: com.telware.sep.system.SysAdmin -r -gc
    Launcher Type: SUN_STANDARD
    h6. Environment Variables:
    JAVA_HOME=/usr/jdk/jdk1.5.0_19
    PATH=/home/sepcs/sep/bin::/usr/jdk/jdk1.5.0_19/bin:/usr/kerberos/bin:/usr/local/bin:/bin:/usr/bin:/usr/X11R6/bin
    LD_LIBRARY_PATH=/usr/jdk/jdk1.5.0_19/jre/lib/i386/server:/usr/jdk/jdk1.5.0_19/jre/lib/i386:/usr/jdk/jdk1.5.0_19/jre/../lib/i3
    86
    SHELL=/bin/csh
    DISPLAY=localhost:10.0
    HOSTTYPE=i386-linux
    OSTYPE=linux
    MACHTYPE=i386
    --------------- S Y S T E M ---------------
    OS:Red Hat Enterprise Linux Server release 5.1 (Tikanga)
    uname:Linux 2.6.18-53.el5 #1 SMP Wed Oct 10 16:34:02 EDT 2007 i686
    libc:glibc 2.5 NPTL 2.5
    rlimit: STACK 10240k, CORE infinity, NPROC 31726, NOFILE 1024, AS infinity
    load average:2.05 2.35 2.23
    CPU:total 2 (cores per cpu 2, threads per core 1) family 15 model 6 stepping 5, cmov, cx8, fxsr, mmx, sse, sse2, sse3
    Memory: 4k page, physical 2009524k(54132k free), swap 1049k(1048k free)
    vm_info: Java HotSpot(TM) Server VM (1.5.0_19-b02) for linux-x86, built on May 4 2009 01:43:34 by java_re with gcc 3.2.1-7a
    (J2SE release)
    time: Sat Nov 7 02:44:28 2009

    Thank you very much first.
    I have noted that the link [t-739313] but I can not found any valuable info for my exception :(
    Yesterday night this crash has been rised again after my server running 1hours, I have analysis the core file, it's stack like this:
    {color:#008080}(gdb) bt
    #0 0xb7f4e402 in __kernel_vsyscall ()
    #1 0x00488c10 in raise () from /lib/libc.so.6
    #2 0x0048a521 in abort () from /lib/libc.so.6
    #3 0xb7990f75 in os::abort () from /usr/jdk/jdk1.5.0_19/jre/lib/i386/server/libjvm.so
    #4 0xb7a6f914 in VMError::report_and_die () from /usr/jdk/jdk1.5.0_19/jre/lib/i386/server/libjvm.so
    #5 0xb77236cc in report_fatal () from /usr/jdk/jdk1.5.0_19/jre/lib/i386/server/libjvm.so
    #6 0xb79fcc5f in SharedRuntime::continuation_for_implicit_exception ()
    from /usr/jdk/jdk1.5.0_19/jre/lib/i386/server/libjvm.so
    #7 0xb7995eb6 in JVM_handle_linux_signal () from /usr/jdk/jdk1.5.0_19/jre/lib/i386/server/libjvm.so
    #8 0xb79930c4 in signalHandler () from /usr/jdk/jdk1.5.0_19/jre/lib/i386/server/libjvm.so
    #9 <signal handler called>
    #10 0x0960527c in ?? ()
    #11 0x429f2160 in ?? ()
    #12 0x429f2158 in ?? ()
    #13 0x4cb72e48 in ?? ()
    #14 0x4cb72f28 in ?? ()
    #15 0x4cb72fe8 in ?? ()
    #16 0x00000000 in ?? (){color}
    I have print the stack from the core file, I found the crashed thread's state which indicted by hs_err_xxx.log is IN_JAVA and no stack information.
    {color:#008080}Thread 12536: (state = IN_JAVA){color}
    (no stack info.)
    {color:#008080}{color:#000000}And from the gc.log, I found that the crash occured in the CMS phase, the last gc log is :
    {color}5814.574: [GC [1 {color:#0000ff}CMS-initial-mark{color}: 829142K(1507328K)] 839697K(1622016K), 0.0281480 secs]
    Total time for which application threads were stopped: 0.0284280 seconds
    5814.602: [{color:#0000ff}CMS-concurrent-mark-start{color}]
    Application time: 1.7093670 seconds
    5816.312: [GC 5816.312: [ParNew: 108858K->8866K(114688K), 0.1133760 secs] 938001K->842222K(1622016K), 0.1135920 secs]
    Total time for which application threads were stopped: 0.1141250 seconds
    Application time: 1.4597160 seconds
    5817.886: [GC 5817.886: [ParNew: 107170K->8372K(114688K), 0.0900130 secs] 940526K->844407K(1622016K), 0.0902690 secs]
    Total time for which application threads were stopped: 0.0907340 seconds
    Application time: 1.4513060 seconds
    5819.428: [GC 5819.428: [ParNew: 106676K->8189K(114688K), 0.0871610 secs] 942711K->846695K(1622016K), 0.0873750 secs]
    Total time for which application threads were stopped: 0.0878680 seconds
    {color:#000000}All above is my found, but I am a newbie in JVM crash, so anybody can help me ?
    and I am very interesting in the Internal Error ID ({color}{color}{color:#ff0000}*53484152454432554E54494D450E43505001A8*{color}{color:#008080}{color:#000000}), I think this ID hide a lot of valuable information for SUN JDK developer, who can interpret it? Thanks very much!
    {color}{color}

  • Any JDeveloper tutorial suggestions for Java/OOP newbie

    I know SQL and basics of OOP. Have Oracle 10g and JDev installed. Got up to Chapter 4 of the on-line JJavaEE tutorial ( http://download-west.oracle.com/otndocs/products/jdev/10131/JavaEE_tutorial.pdf ), but then got lost after that. Too complex of an example app and not enough explainations of WHY the steps were to be taken in the tutorial. Anyone know of a SIMPLE tutorial that would be good to use with JDeveloper?
    Paul Peterson

    There is a bunch of tutorials linked from the JDeveloper home page on OTN: http://oracle.com/technology/jdev
    I would suggest to start with the following 3:
    Get to know the IDE:
    http://www.oracle.com/technology/obe/obe1013jdev/10131/introide/introjdevide.htm
    Get to know ADF:
    http://www.oracle.com/technology/obe/obe1013jdev/10131/masterdetail_adf_bc/master-detail_pagewith_adf_bc.htm
    Get deeper into ADF:
    http://www.oracle.com/technology/obe/ADFBC_tutorial_1013/10131/index.htm
    But you should also check all the rest there.

  • Please Suggest - new java.text.DecimalFormat Question

    table2.setValueAt(
    "$"+new java.text.DecimalFormat("#.##").format
        ((Double.valueOf(table2.getValueAt(row,1).toString())).doubleValue())*
        ((Double.valueOf(table2.getValueAt(row,2).toString())).doubleValue())
    row,
    3
    );Is there a way to force DecimalFormat to display .00?
    Is there a way to ignore a "$" preceding the value from table2.getValueAt(row,1)?

    Is there a way to force DecimalFormat to display .00?YES: new java.text.DecimalFormat("\u00A40.00").format

  • Improvement suggestion for java.lang.Iterable

    The current design limits each container to one collection. Wouldn't it be better to define java.lang.Iterable as
    interface Iterable<T> {
    Iterator<T> iterator(Class<T> class)
    Then a conainer could hold multiple collections, as long as each collection contains different types.
    Then I could write
    class Zoo
    implements Iterable<Tiger>,
    implements Iterable<Elephant> {
    Iterator<Tiger> iterator(Class<Tiger> class) ...
    Iterator<Elephant> iterator(Class<Elephant> class) ...
    and the compiler would be able to handle this:
    for (Tiger tiger : zoo) .. give me all Tigers
    for (Elephant elephant : zoo) .. give me all Tigers

    The current design limits each container to one collection. Wouldn't it be better to define
    java.lang.Iterable as
    interface Iterable<T> {
    Iterator<T> iterator(Class<T> class)
    }If you were to do that, none of the existing Collection types could implement it without breaking backward compatibility.
    Then I could write
    class Zoo
    implements Iterable<Tiger>,
    implements Iterable<Elephant> {Unfortunately it's not possible to implement the same interface twice with different type arguments. I say unfortunately because I believe one of my own API designs would benefit from that capability, if it were possible.
    and the compiler would be able to handle this:
    for (Tiger tiger : zoo) .. give me all Tigers
    for (Elephant elephant : zoo) .. give me all TigersYou can still do this:
    class Zoo {
        Collection<Tiger> tigers() { ... }
        Collection<Elephant> elephants { ... }
    for (Tiger tiger : zoo.tigers())  ...
    for (Elephant elephant : zoo.elephants()) ...Mark

  • Need the career suggestion for Java developer

    Dear all,
    I am a programmer with four years experience in webMethods integration. I am also good at Oracle PL/SQL, XML and Java.
    So, here is my question, shall I study for an ABAP certification and begin to look for an ABAP job? or, based on my background, I should try to get a Netweaver Java Certification and try to move to portal development or SAP XI?
    Regards,
    Mike
    Message was edited by:
            Mike Eng

    hi mike,
    Its good u have such a good experience in webmethods and oracle/pl-sql and also java. i feel abap would be much better option to move on to.
    ABAP is sap custom language, and it would always be preferred more over everthing else, and apart from that certified abapers are still very few, while compare that with java, which is at peak in the job market,and flodded with java proffesionals.
    And as u have previous experience getting through abap certification wont be tough.Happy abap programing.......!!!!
    Best of luck

  • JVM suggests updating Java, but discover I already have the latest version

    I have Java version 1.6.0_03-b05 installed on my pc. Once a week (because it is set to check once a week) Java issues a message saying
    A new version of Java is ready to be installed. Click here to continueBut when I do so, another message is issued, saying
    You already have the latest Java(TM) Platform on this systemWhy does it issue the first message if already latest version?
    Henrik

    You have 2 versions of Pages on your Mac.
    Pages 5.2.2 is in your Applications folder.
    Pages '09/'08 is in your Applications/iWork folder.
    You are alternately opening the wrong versions.
    Pages '09/'08 can not open Pages 5 files and you will get the warning that you need a newer version.
    Pages 5.2 can open Pages '09 files but may damage/alter them. It can not open Pages '08 files at all.
    Older versions of Pages 5 can not open files from later versions of Pages 5.
    Once opened and saved in Pages 5 the Pages '09 files can not be opened in Pages '09.
    Anything that is saved to iCloud and opened in a newer version of Pages is also converted to Pages 5 files.
    All Pages files no matter what version and incompatibility have the same extension .pages.
    Pages 5 files are now only compatible with themselves on a very restricted set of hardware, software and Operating Systems and will not transfer correctly on any other server software than iCloud.
    Apple has removed over 110 features from Pages 5 and added many bugs:
    http://www.freeforum101.com/iworktipsntrick/viewforum.php?f=22&sid=3527487677f0c 6fa05b6297cd00f8eb9&mforum=iworktipsntrick
    You can add the icon of the missing Pages on your Dock or open Pages from the Apple menu > Recent Items list.
    Or you can archive Pages 5 so that it doesn't automatically open.
    If you are unhappy about this review/rate Pages 5 in the App Store.
    Peter

  • Suggest a java API to flatten dynamic XFA forms

    I have a dynamic XFA form created using LiveCycle designer 8.2
    I want to flatten the form programatically for further processing.
    Does Adobe provide any API for this ?
    Thnks.,

    Michael Mitiaguin (guest) wrote:
    : Previously two APIs were supported.
    : Just citing :
    : "The C Application Program Interface (C API) is a
    : state-of-the-art programmatic interface to Oracle TextServer3
    : with ConText,
    : and is shipped as part of the Oracle Text Developer's
    Workbench.
    : It consists of a set of C-coded functions that you can use to
    : build calls to Oracle TextServer3 into your own applications.
    : The Forms 4 Application Program Interface (API) is a
    : state-of-the-art programmatic interface to Oracle TextServer3
    : with
    : ConText, and is shipped as part of Oracle Text Developer's
    : Workbench. It consists of a set of PL/SQL functions and
    : procedures that you can use to build calls to Oracle
    TextServer3
    : into your own Oracle Forms 4 applications. "
    : What about Java API for the time being ? I am interested in
    : feasibily of Java application with quite typical functionality.
    : VCR screen for navigation among records which satisfy
    : advanced search conditions. Each record is a huge chunk of text
    : ( let's say presented by TextAreaControl or probably specific
    : JavaBean component. I know ctv32.ocx existence for viewing
    : something in native format in regard to Windows applications )
    : and I want to navigate from hit to hit having them highlighted.
    There is no specific functionality in JDeveloper for this API.
    For a generic JAVA API in Intermedia, I could find no references
    to one.
    You may want to search for more info on Intermedia at:
    http://www.oracle.com/database/options/intermedia.html
    Regards,
    -Chris
    null

  • Suggestion in java-mail

    Hi experts,
    I finished up coding a mail system some time back.
    At present,i am interested to improve it.
    There are two issues:
    (1) When i read my inbox,the code fetches all mails from pop server
    irrespective of new and old.
    (2) After seeing mails through my program ,if i switch on
    to Outlook Express,the mails are considered as new even on
    seeing htem through my program.
    Issue (1) is more critical to me and i feel if i can get through this then
    i could easily overcome (2).
    One common suggestion i get is to store mails on my machine .
    How to proceed.I am stuck.

    The preferred approach is:
    MimeBodyPart messageBodyPart = new MImeBodyPart();
    messageBodyPart.setText(message, null, "html");
    If you need to force a particular character set, you can replace "null" with (e.g.) "utf-8".

  • I have a brand new iMac, Yosemite 10.10.1, Java Version 8, Update 25, however, I still get a window when I open Adobe Photoshop CS5, that indicates that I need to install Java SE 6 Runtime. Any suggestions?

    I have a brand new iMac, Retina 5K, Yosemite 10.10.1, with Java Version 8, Update 25, however, I still get a window when I open Adobe Photoshop CS5, that indicates that I need to install Java SE 6 Runtime. Any suggestions?

    Java should be downloaded directly from Apple:
    Java for OS X 2014-001

  • I would like to know which Sun Cert JAVA Course should I take ???

    I am a very good C programmer that is trying to learn Java programming.
    I know my way around all the various programming statements such as if-then-else, switch etc etc ...
    I know the basics of an Applet and a Stand Alone application ...
    I feel that I need some grounding on OO Technology ...
    I would like to learn JAVA from where I am ...
    I have also been reading up a lot on Java Programming lately ...
    I am more of an Intermediate programmer ...
    I have seen the Sun Certified Java courses web page and is quite confused by the many assortment of courses available ...
    I would like to ask which Java Course is right for me at my level of programming experiences ???
    Thanks in advance !!!
    Andy

    www.jcert.org has the information laid out a little better. I picked up Java without a formal course and I had about the same specs as you (although I had done a fair amount of c++ work). I would suggest the Java book by van der Linden (I know I'm not spelling the name right). I think it's called Just Java 2. Also Thinking in Java by Eckel has gotten good recommendations. For exam prep, the Exam Cram book by Brogden is highly recommended, but it won't teach you OO.

Maybe you are looking for

  • Have can't open iphot because power pc apps are no longer supported

    I recently burned up an 8 year old Mac (all in one machine) for lack of better terminology. It was replaced with a MacMini so I could connect to an existing monitor. Upon launching, I have an error, when I open iPhoto or iDVD, etc that says:  Can't o

  • I can't click on my dock

    Hi, I can't click on my dock. it is not working. the last thing I did was an update for my laptop. After that the dock doesn't work PLEASE HELP

  • Re: Activation Server shut down for Creative Suite 2, Acrobat 7 and Macromedia products

    Software : Adobe Encore DVD 2.0 / UK, purchased october 24, 2006 Operating system : Windows XP home edition / SP3  Computer : Pentium 4 / 1,8GHz - 512 MB Other software : Adobe Premiere 6.5 / Photoshop Elements 5.0 / QuickTime 7, etc. My harddrive cr

  • How to trigger event when changing user status?

    hi, I'm having problems in triggering my workflow. In CIC0, When a status of a service request is changed to 'solution provided' then after saving service request, it should send a notification mail. I'm using ZBUS200116 which is deligated to BUS2000

  • Delete Software Product from Licensing Adapter in Visual Admin

    Hello, I have installed standalone JAVA system. By mistake I applied the NW (ABAP + JAVA) license in Visual Admin. So under Software Products under Licensing Adapter Service, it now shows 3 software products viz. J2EE, Maintenance and NetWeaver. I de