Page 1 of 2 12 LastLast
Results 1 to 20 of 23
  1. #1
    softwaretalks is offline Member
    Join Date
    Jul 2009
    Posts
    6
    Rep Power
    0

    Default Can help with java technologies

    Hi, community

    I am experienced java (and other) developer with knowledge in spring, jboss, oracle and so on. I am certified in these subjects.
    Know a lot about these words: Spring, Hibernate, JNDI, JMS, Servlets/JSP, Junit, GIT, svn, MS SQL, Oracle, PKI, UML, Design Patterns...hm, and many others
    Long ago, when I came to java world, it was hard to find out, which framework to use, when use them and so on. I had a lot of questions about architecture and code design, code management, continuous integration...I know that a lot of developers have the same problems.
    But I also have "problem" - not in development, but in communication. English is not my native language, although I use it for years...The problem is in speech practice. I read documentation, write documentation, write emails and forums and have almost none practice in speech. Another one problem is talk subjects: I do English only for software....

    I suppose my idea is clear now.

    If you are English speaking person, we can meet in skype and I will tell you a lot about java world (and those scary words from above). You will get great info, I will get practice ;)

    If you are interested, let me know by email: softwaretalks@yahoo.com, with your skype ID
    and I will contact you. I don't say I will contact you immediately - but I will!

    thank you!

  2. #2
    Eranga's Avatar
    Eranga is offline Moderator
    Join Date
    Jul 2007
    Location
    Colombo, Sri Lanka
    Posts
    11,372
    Blog Entries
    1
    Rep Power
    20

  3. #3
    rahultaneja7 is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default

    Hello Sir ,

    As i m a beginner I have some queries with in basic of java J2se.i am basically confused in the rule of interface example if we want to create ab object of ArrayList......


    ArrayList ar=new ArrayList(Collection c);

    here c is the object(refrence variable) of Collection. then why it is possible to use or pass the objects(in below example object v) of other(like ArrayList,Vector,LinkedList etc) classes which is implementing the the Collection interface in this constructor
    eg... Vector v=new Vector();
    v.add("aaa");
    v.add("bbb");
    ArrayList ar=new ArrayList(v);

    we can only use the Object of Collection interface then how can it be possible topass other classes objects it is not according to rule passing paramenters

    i have also tried passing (interface)Enumeration object (refrence variable) in
    Vector v=new Vector();
    Enumeration e=v.elements();

    SequenceInputestream in=new SequenceInputestream (e);
    is correct but when i tried to pass the object of StringTokenizer(this class implements Enemuration interface same as Vector implements Collection Interface) it did't work

    hope u know my query and will reply me

  4. #4
    softwaretalks is offline Member
    Join Date
    Jul 2009
    Posts
    6
    Rep Power
    0

    Default

    Hi

    the key is interface definitions: java has core interface Collection, and Collection has children List, Set and others
    So ArrayList, Vector and other are concrete implementations of these interface

    google for "is a" concept

    Example:

    ArrayList array = new ArrayList();
    This is not optimal way of declaring variable: variable should be as generic as possible, to decrease coupling in your code
    So right way is:
    List array = new ArrayList();


    Other example

    You have:
    new ArrayList(Collection c)

    if you will create:
    ArrayList arraylist = new ArrayList();
    Vector vector = new Vector();
    LinkedList linkedlist = new LinkedList();
    and will check these obects with instanceof:
    if (arraylist instanceof Collection) {
    System.out.println("true");
    }
    if (vector instanceof Collection) {
    System.out.println("true");
    }
    if (linkedlist instanceof Collection) {
    System.out.println("true");
    }

    you will get 3 thues, as all these objects are collections

    hope this helps
    p.s.
    my skype is 'softwaretalks'

  5. #5
    rahultaneja7 is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default

    Hello sir,

    Thanks a lot for your reply, i get fustrated when i dont get the solution of any problem even after a lot of research and development,as i am learning javaa alone nobody is helping me but today i found someone who will solve my queries thanx sir

    i have tried and it also helped but i also tried one more thing, the program i tried is given below

    import java.util.*;
    import java.io.*;
    class coltes
    {
    public static void main(String args[])
    {
    Vector v=new Vector();

    if(v instanceof Vector)
    {
    System.out.println("true"); //it will print true
    }

    StringTokenizer st=new StringTokenizer("a b c d s"," ");

    if(st instanceof Enumeration)
    {
    System.out.println("true");// it will print true
    }

    //SequenceInputStream sr=new SequenceInputStream(st); //error in this line cannot find constructor
    }
    }
    its working fine but here is one error in this line
    SequenceInputStream sr=new SequenceInputStream(st);// st is object of StringTokenizer
    as you said Vector,ArrayList etc are concrete implementations of Collection interface
    but its not working in the case of StringTokenizer when is used it in place of Enumeration
    interface.
    reply me when you will read this query

  6. #6
    softwaretalks is offline Member
    Join Date
    Jul 2009
    Posts
    6
    Rep Power
    0

    Default

    google for "java 5 javadoc" and add that page to bookmarks

    and this page contains information you need:
    java.sun.com/j2se/1.5.0/docs/api/java/io/SequenceInputStream.html#SequenceInputStream

    java 5 has generics for all collections: so your collection must contain InputStreams only

    So this will compile:
    Java Code:
    Enumeration<InputStream> fake = null; 
    SequenceInputStream sr= new SequenceInputStream(fake);
    Last edited by softwaretalks; 07-10-2009 at 10:31 PM.

  7. #7
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    softwaretalks welcome to our community! We're very glad to have you contributing. One tip that will make your code posts a little easier to read is to use code tags. They will help your code to retain its formatting. There are two ways to do this:
    1) Highlight the code you've pasted and press the code button, or
    2) Manually place the tag [cod&#101;] above your code block and [/cod&#101;] below your code block.

    Hope to see more of you here, and hope this helps!

  8. #8
    rahultaneja7 is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default

    Hello sir,

    How are you?
    I have just started the topic of thread and i have one query, i executed that below code its working fine but i have some confusion here in this code
    thread.start();
    why this line working because according to rule (inheritance) when we create the object of super class(Thread thread;) by giving the refrence (thread= new BasicThread1();) of Base class, We can only call or use those methods which are available in Base class and(thread.start();) this method is not available or overriden in base class then why its working fine...

    Sir please send me any link or notes where more examples of thread are available by which my basic on this thread topic will become stronger


    Java Code:
    // This class extends Thread
        
    class BasicThread1 extends Thread {
            // This method is called when the thread runs
            public void run() {
    System.out.println("this is BasicThread's run method.");
            }
        }
    
    class BasicThread2
    {
    public static void main(String args[])
    {
        // Create and start the thread
        Thread thread = new BasicThread1();
        thread.start();// i did't get this line.......
    }
    }

  9. #9
    Fubarable's Avatar
    Fubarable is offline Moderator
    Join Date
    Jun 2008
    Posts
    19,316
    Blog Entries
    1
    Rep Power
    26

    Default

    Thread's start method will call the run method, and in this situation will call the inherited run method.

    Having said that, you really shouldn't extend Thread here but instead should implement a Runnable.

  10. #10
    softwaretalks is offline Member
    Join Date
    Jul 2009
    Posts
    6
    Rep Power
    0

    Default

    There are two methods to create new thread in java
    1. extend Thread class
    2. implement Runnable interface

    Both cases require you to override run() (override or implement). But you should never call run directly, as this will execute all commands in the same thread.

    start from Thread creates real thread and run "run()" in it

    class BasicThread1 extends Thread
    means BasicThread1 has all public, private and default methods of Thread

  11. #11
    rahultaneja7 is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default How to put value in Servlet's HTML textbox?

    Hello sir, I have one query of Servlet

    Below is the code of welcome page which include 2 textbox in which user
    Will put value1 and value2.
    Java Code:
    <html>
    <body>
    
    <form action="Add" method="get">
    Value1 <input type="text" name="t1" /><br>
    Value2 <input type="text" name="t2" /><br>
    
    
    <input type="submit" name="b1" value="click" />
    </form>
    </body>
    </html>
    After clicking on the submit button this HTML page would be redirected to Servlet (Add.java). The code of Servlet Add is given below
    Java Code:
    import java.io.*;
    import javax.servlet.*;
    
    public class Add extends HttpServlet {
     	public void doGet(HttpServletRequest request, HttpServletResponse response)
    			throws ServletException, IOException {
    		response.setContentType("text/html");
    		PrintWriter out = response.getWriter();
    Int a=0,b=0,c=0;
    String st1=request.getParamater(“t1”);
    a =Integer.parseInt(st1);
     String st1=request.getParamater(“t2”);
    b =Integer.parseInt(st2);
    c=a+b;
    
    out.println(“<html><body><form>”);
    out.println(“Addition Result: <input type=\”text\” name=\”textbox1\” value=\”\”>”);
    out.println(“</html></body></form>”);
    }
    }
    This Add servlet includes the code of addition of those two values which was given by the user in welcome page. My query is how can we put the value of int variable c (c=a+b;) in the textbox named textbox1? Or how can we give the value of any variable to the attribute (value) of textbox?

    Thanks
    Hope you will reply as soon as possible.

  12. #12
    softwaretalks is offline Member
    Join Date
    Jul 2009
    Posts
    6
    Rep Power
    0

    Default

    Hello

    First of all you can just write string + int + string, this will print html as you need.

    But it is not a good idea to mix presentation code (html) with business code (servet)
    You should add view jsp and use JSTL (very simple set of tags to work with UI)

    Take a look at spring mvc - they have good samples

  13. #13
    rahultaneja7 is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default put value in to Textbox (Servlet)

    Thanks for your relpy sir

    i am a beginner in J2ee, i just started with Servlet and most of the topic(JSP etc) and frame work are left to learn. you wrote "write string + int + string, this will print html as you need." i did't get it, could you give an example for it.
    My query is like with the help of request.getParameter we retrive the data of textbox lie this i want to insert the data in text box
    Kindly huid me for this

    Thanks

  14. #14
    softwaretalks is offline Member
    Join Date
    Jul 2009
    Posts
    6
    Rep Power
    0

    Default

    just add string to value
    ....value = \" + request.getParameter("text") + "\" >"...

  15. #15
    RamyaSivakanth's Avatar
    RamyaSivakanth is offline Senior Member
    Join Date
    Apr 2009
    Location
    Chennai
    Posts
    804
    Rep Power
    6

    Default

    Hi softwaretalks,
    Welcome to our forum!!!!!!!!!!!!!! Being an experienced professional,I hope you will be an inspiration to emerging Java developers!

    -Regards
    Ramya
    Ramya:cool:

  16. #16
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default

    Quote Originally Posted by softwaretalks View Post
    just add string to value
    ....value = \" + request.getParameter("text") + "\" >"...
    You're missing a quote...easy to do outside an IDE.

    Quote Originally Posted by softwaretalks View Post
    just add string to value
    ....value = \"" + request.getParameter("text") + "\" >"...
    ...now it'll turn out I missed something...:)

  17. #17
    rahultaneja7 is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default java basic print integer variable

    Hello Sir

    i am bit confuse when i am printing integer variable is printing somthing else
    example given below:

    Java Code:
    class integer
    {
    public static void main(String args[])
    {
    int i= 010;
    System.out.println("i="+i);   //its printing 8 but it should print 10
    
    int a=0x10;
    System.out.println("a="+a);  //its printing 16 
    
    }
    }
    kindly solve my query
    thanks

  18. #18
    steelshark is offline Member
    Join Date
    Aug 2009
    Posts
    25
    Rep Power
    0

    Default

    Hi there, i have sent you an email with my skype account info.
    I am not a native english speaker either, but my written and spoken english is pretty good.
    So if you are interested just let me know.
    My java experience is based on school projects and lessons.
    I mastered the basics, and i am familiar with jdbc and swing aswell=)
    hope to hear from you soon, greetz.

  19. #19
    Tolls is offline Moderator
    Join Date
    Apr 2009
    Posts
    11,802
    Rep Power
    19

    Default

    Quote Originally Posted by rahultaneja7 View Post
    Hello Sir

    i am bit confuse when i am printing integer variable is printing somthing else
    example given below:

    Java Code:
    class integer
    {
    public static void main(String args[])
    {
    int i= 010;
    System.out.println("i="+i);   //its printing 8 but it should print 10
    
    int a=0x10;
    System.out.println("a="+a);  //its printing 16 
    
    }
    }
    kindly solve my query
    thanks
    It's printing exactly what you asked it to.
    Look up octal and hexadecimal.

  20. #20
    rahultaneja7 is offline Member
    Join Date
    Jul 2009
    Posts
    9
    Rep Power
    0

    Default Hello steelshark

    Hello steelshark,

    I just read your post, i am very much intreasted in learning Java techonology.
    As u said u have sent me an email regarding skype account info, i did't get any such email i am going to check it again.

    I am really thankful to you (softwaretalks,Tolls) , all other members and owner of the java-forums who are helping not only me, many other folks also who getting difficulties in learning java.

    hope you will reply

    Thanks

Page 1 of 2 12 LastLast

Similar Threads

  1. Embedded Java Middleware in STB Technologies
    By neel_vk in forum Jobs Offered
    Replies: 1
    Last Post: 08-11-2009, 03:46 PM
  2. Replies: 0
    Last Post: 03-16-2009, 10:01 AM
  3. Replies: 0
    Last Post: 03-13-2009, 10:13 AM
  4. Replies: 3
    Last Post: 02-13-2009, 04:34 PM
  5. Replies: 0
    Last Post: 01-28-2009, 06:11 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •