Skip to main content

Posts

Showing posts with the label MyEclipse

Q) Develop a JDBC application / project that prompts the end-user to enter the table name and that displays all the column names of the table.

A) ->ResultSet interface doesn’t have any methods directly to know about column details. For that purpose we need to use “java.sql.ResultSetMetaData” interface. ->it has methods to deal with column details. 1) getColumnCount() 2) getColumnName(int no ) ->Here no means column number. ->ResultSetMetaData object is created as fallows resultSetMetaData rsmd=rs.getMetaData(); Example: // columndetailsexample.java import java.sql.*; import java.util.Scanner; class columndetailsexample {        public static void main(String[] args) throws ClassNotFoundException   ,SQLException{               Scanner s= new Scanner(System. in );               System. out .println( "Enter table name" );               String table=s.next();    ...

Q) What are some important shortcuts to interact with MyEclipse

A) Ctrl+s for saving Ctrl+m For minimizing / maximizing Syso+ctrl+spacebar For System.out.println() Ctrl+w For closing a file Ctrl+shift+w For closing all files Ctrl+/ For connecting or un connecting Ctrl+d For deletion of a line which the cursor is pointing Ctrl+shift+o For organizing imports. The means un import things are import and un necessary imports are removed Ctrl+shift+f For formatting the code Ctrl+z For undo Ctrl+y For redo

Q) How to develop a java application using MyEclipse that displays “hello world” on console

A) Step 1) Create a new java project File->new->Java project->Enter Project Name Step 2) Create a userdefined package within “src” directory (given by MyEclipse into which we store all our java files and src means java source code). Right click on “src directory->new->package->enter the package name For example: com.prince (reverse domain naming connection is fallowing by industry for package names) Step 3) Create a class with main Right click on package ->new->class->Enter the class name->select the main option. Step 4) Write System.out.println and run the application. Right click on editor->Run As->java Application.