- Strength to Increase Rep
- +0
- Strength to Decrease Rep
- -0
- Upvotes Received
- 0
- Posts with Upvotes
- 0
- Upvoting Members
- 0
- Downvotes Received
- 15
- Posts with Downvotes
- 5
- Downvoting Members
- 8
Passion for java
16 Posted Topics
Re: The best way of programming is to make your fields(member variables) always private and make your methods public to preserve encapsulation in java. The setter(mutators) and getter(accessors) methods are used to set and get the field values by other classes. you can directly use yourobject.hashCode() to find the hash code. | |
Re: Well you could do this many ways....use html form as front end and connect to some database and perform all the functionalities...or use swings and use a text file as a persistent store...how r u supposed to do this? | |
hi, i deployed a webapplication(wapp1) having input.html and a servlet(Servlet1) in tomcat web server. The form input.html just accepts a text and when u click on the button click the request is sent to servlet in wapp1. The request is redirected to a servlet(Servlet2) which is in a webapplication(wapp2) deployed … | |
Which is the most efficient way of creating a string object in java? [icode]String s="helo";[/icode] or [icode]String s=new String("helo");[/icode] in terms of memory usage? Thanks in advance... | |
Re: [QUOTE=qutejose;1132219]Does J2EE support Enterprise applications? Is Java Beans an application dependent components? Does JavaBeans support sharing among the network? 1 Javabean can contain how many classes? Does Servlets execution starts with main methods?[/QUOTE] servlets doesnt start with main method....servlet has lifecycle methods which are executed by a web server or … | |
Re: Otherwise u do one thing....compile ur servlets .java files and place the .class files manually in the WEB-INF/classes folder then it shld work...and one more thing...did u make ur servlet public?.... | |
Why java doesn't support multiple inheritance?thank you.... | |
Re: Well i am not sure if we can directly call a user-defined method of one servlet from another servlet....but we can achieve this in this way....I have defined an user defined method in servletB and called it in doGet() lifecycle method of SerletB and from the ServletA's life cycle method … | |
Re: Well...this is a code snippet to connect to oracle data base using type-1 driver using your java program:...hope this helps you...... import java.sql.*; class DbConnection { public static void main(String[] args) { try{ Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); Connection con=DriverManager.getConnection("jdbc:odbc:Fardoon","scott","tiger"); DatabaseMetaData dbmd=con.getMetaData(); String str=dbmd.getDatabaseProductName(); System.out.println("The name of the database you are using is: "+str); … | |
If a class doesnt override toString() method and tries to print out the object like this: //some class [code] public class SomeClass1{ int x=4; } //another class class DemoOftoString { public static void main(String[] args) { SomeClass1 o=new SomeClass1(); System.out.println(o); } } [/code] output:SomeClass1@hex version of object's hash code ------------------------------------------ … | |
Re: /*this code shld work...5/9 returns 0 so use 5/9.0 which returns float value*/ import javax.swing.JOptionPane; public class Test{ public static void main(String args[]){ String numT = JOptionPane.showInputDialog(null,"Please enter a value."); double num1 = Double.parseDouble(numT); System.out.println("Fahrenheite = "+num1+"\nCelcius = "+convertFtoC( num1 )); } public static double convertFtoC ( double num1 ){ … | |
can anyone explain what is a lightweight application?....Thanks | |
Hi, I have a doubt here, plz go thru the code snippet here: Statement st=con.createStatement(); ResultSet rs=st.executeQuery("select * from emp"); Statement and ResultSet are interfaces. executeQuery() method of Statement interface returns a ResultSet object here. That means defnitely Statement should implement ResultSet interface methods to return a ResultSet object, but … | |
Re: GregorianCalendar(concrete class) is a subclass of Calendar(abstract class).So u can use either....So u can say GregorianCaendar c=new GregorianCalendar.......thanks | |
Re: import java.util.*; class ClassOne { public static void main(String[] args) { int eid; String ename; double salary; Scanner sin=new Scanner(System.in); System.out.println("Enter eid"); eid=sin.nextInt(); System.out.println("Enter ename"); ename=sin.next(); System.out.println("Enter salary"); salary=sin.nextDouble(); Employee e1=new Employee(); e1.accept(eid,ename,salary); e1.display(); System.out.println("Enter eid"); eid=sin.nextInt(); System.out.println("Enter ename"); ename=sin.next(); System.out.println("Enter salary"); salary=sin.nextDouble(); Employee e2=new Employee(); e2.accept(eid,ename,salary); e2.display(); if(e1.equals(e2)) System.out.println("Both … | |
Re: This works...try this import java.util.*; class ScannerDemo{ public static void main(String[] args) { System.out.println("please enter some thing"); Scanner s=new Scanner(System.in); while(s.hasNext()){ System.out.print(s.nextInt()+" "); }//end of while } } |
The End.