How to create a class in java

 
 

Share on Google+Share on Google+

Java Coder
How to create a class in java
1 Answer(s)      5 years ago
Posted in : Java Beginners
Ads

I am a beginner in programming and tried to learn how to do programming in Java. Friends please explain how can I create a class in Java.

Ads
View Answers

January 5, 2013 at 12:48 PM


hi friend, As you said that you are a learner of Java programming and want to create a class in Java so, lets understand first what is class in Java.

Class in Java is a blueprint that facilitate you to declare data members and methods as well as to define methods.

Here sample code is being given which demonstrates how to create a class in Java.

public class JavaSampleClass
{
   int i = 5;
   String str = "How to create a class in Java";
   public void intDisplay()
    {
       System.out.println(i);
    }
   public void strDisplay()
    {
       System.out.println(str);
    }   
}

Ads









Related Tutorials/Questions & Answers:
How to create a class in java
How to create a class in java  I am a beginner in programming and tried to learn how to do programming in Java. Friends please explain how can I create a class in Java
to create a java class and methods
to create a java class and methods  How to create a java class without using the library class to represent linked lists of integers and also provide it with methods that can be used to reverse a list & append two lists.Also
Advertisements
how to create notepad in java
how to create notepad in java  how to create notepad in java
create named class - Java Beginners
create named class  Can you check my [email protected]: How to create a class named Employee with name and salary. Make a class Manager inherit from...() that prints the manager?s name, department and salary. Make another class named
How to Create Keyboard in JAVA
How to Create Keyboard in JAVA  please help me to create On-Screen Keyboard with java and please give me an another idia to make it ..............iam waiting for your help ,think u so much
How to create charts in Java?
How to create charts in Java?  Is there any example of creating charts and graphs in Java? thanks   Hi, check the tutorial: Chart & Graphs Tutorials in Java Thanks
how to create interfaces in java
how to create interfaces in java  HI, Here is my code public interface validateInfo { public void validate(String empcode, String password); } class updateInfo implements validateInfo { public void update() { //code
how to create reports in swing java?
how to create reports in swing java?  how to create reports in swing java
How to create first program in Java?
How to create first program in Java?  Hi, I am new in Java programming. Tell me How to create first program in Java? Thanks   Hi, Read more at First Java Program. Thanks
create a class
create a class  plz provide any example related to class
How to create first Java Program?
How to create first Java Program?  Hi, I am beginner and I want to write first Java program. How I can setup my machine and write first Java program... and run first Java program: Create program in Note pad: Step 1: Open
How to create and use Array in Java?
How to create and use Array in Java?  Hi, How to create and use Array in Java? Write program to construct and use the array. Thanks   Hi... can read complete example at Array in Java. Thanks
how to create executable - Java Beginners
how to create executable  How do i create a executable file from a java file thnks in adv...!  Hi Friend, Try the following code: import java.io.*; import java.util.jar.*; public class CreateExe { public
how create package of this java code
how create package of this java code  Hi,i have email code in java... java.io.*; public class sendmail { private static final String SMTPHOSTNAME...); msg.setContent(message, "text/plain"); Transport.send(msg); } private class
how create package of this java code
how create package of this java code  Hi,i have email code in java...*; import java.io.*; public class sendmail { private static final String..., "text/plain"); Transport.send(msg); } private class
how to create users in LDAP using java?
how to create users in LDAP using java?  how to create users in LDAP using java
how to create exce sheet using java
how to create exce sheet using java  how to create excel sheet using java
how to create an excel file using java
how to create an excel file using java  how to create an excel file using java
How to Create CurveDraw In Java
How to Create CurveDraw In Java       Introduction In this section, you will learn how to create CurveDraw in java.awt package. This class,supported by the java.awt.geom package
How to create new arraylist using Java
someone provides online example how to create new arraylist in java programming. thnaks,   Hi, In java programming language you can create new...How to create new arraylist using Java  hi, I want to develop
how to create a header in jtable using java swing
how to create a header in jtable using java swing  how to create a header in jtable using java swing   d
In Java how to get size of class and object?
In Java how to get size of class and object?  In Java how to get size of class and object
In Java how to get size of class and object?
In Java how to get size of class and object?  In Java how to get size of class and object
How do I decompile Java class files?
How do I decompile Java class files?  How do I decompile Java class files
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create pdf file using java and itextjar
how to create pdf file using java and itextjar  How to create pdf file having paragraphs and alignments done using java and itextjar 5.10 version.? hope i get quick response
how to create this diamond structure with java. - Java Beginners
how to create this diamond structure with java.   * *** ***** * *** *** * ***** * *** *** * ***** * *** *** * ***** *** *  ..., Try the following code: class Stars{ public static void main(String
how to create month wise serial number in java?
how to create month wise serial number in java?  Ex: For 1)January-serial number is 1/001,1/002,1/003 etc
java how to create visual swing editor
java how to create visual swing editor   How do I create a visual swing designer in java ?Meaning that I can "draw" a button,a JTextArea from within my designer program . I just need some basics . I've got no idea how to start
How to Create Car Rental Application in Java ?
How to Create Car Rental Application in Java ?  Hi, How to Create a Car Renal Application using Java to Check the Car renting, booking... the car rental apps in Java
How to create custom exception in Java?
How to create custom exception in Java? In this tutorial we are going to create our own exception class and you will learn the steps to create custom exception class. Custom exceptions are used by Java developers to create

Ads

 
Advertisement null

Ads