purple_coat
q2
1 Answer(s)      a year and 7 months ago
Posted in : Java Beginners

provide me a java coding based on the following algoritm start defining the MyClass Declare the class's myField data field Initilize the data field Start defining the SetField() method set the data field to the value passed to SetField() Start defining the GetField() method Return the value of the myField data field

View Answers

October 21, 2011 at 11:03 AM


class MyClass{

    private int myField;

    public MyClass(int value){
          myField = value;
    }
    public void SetField(int value){
          myField = value;
    }
    public int GetField(){
          return myField;
    }

    public static void main(String []args){
    MyClass cl=new MyClass(10);
    int i=cl.GetField();
    System.out.println(i);
    }
}









Related Pages:
q2
q2  Which term refers to the characteristic of an identifier that determines where the identifier can be used? scope data type address value/data no answer
q2
q2  provide me a java coding based on the following algoritm start defining the MyClass Declare the class's myField data field Initilize the data field Start defining the SetField() method set the data field to the value passed
java - Java Beginners
java  Q1>:what could company except from java fresher? Q2>:plz tell the basic questions asked for fresher during interview?   Hi Friend, For interview questions, visit the following link: http
Struts2 tags - Struts
Struts2 tags  Q1. i define a statement like " style= "visibility:hidden" in my struts2. this statement is not working. Can you please tell me the solution of this. Q2. if above code can not work then how can i do
java loops - Java Beginners
java loops  Q1-sum the series 2/9-5/13+8/17..... Q2 print first n odd numbers in descending order? Q3 program to input digits and write in words with out using any type of in built function and array program to print truth
servlets
servlets  q)What will happen if you donâ??t write the implementation in service () of our Servlet? Which method () it will call? q2)How many times init() execute and what happen if browser is close and server shutdown ? JSP
Java - Java Beginners
Java  Sir,plz help me to solve these java problems: Q.1. Write a Progarm to illustrate the concept of multiple inheritance using interface Q.2. Write a program to illustrate subclasses an imported class Q.3. Write
java code and logic - Java Beginners
java code and logic  Q1: how to write java program for the following: * * * * * * * * * * * * * Q2: S T R I
java - Java Beginners
q2=new q(5); q2.print(); q q3=new q(2,10); q3.print
Java Programming Help
with paging. Q2: I want the code and idea about to "When user can click
Write a program in java...
as a user wishes. Print the result up to two places of decimal. Q2: Ask the user
java code and logic - Java Beginners
java code and logic  Q1: PRINT FIRST 100 PRIME NUMBERS? Q2; INPUT A NO. FROM THE USER REVERSE THAT NO. AND INCREMENT IT WITH 1 AND THEN PRINT IT. Q3: HOW TO PRINT THIS STRING s T R
java - IDE Questions
as 5/5/2010 q2)I have two table namely FEE(Fileno,Stname,Totalfee,Feepaid,Balance
Loops
it asap ><   q2. Write code that ask user to insert an integer (n
using if and switch stmt - Java Beginners
; case 2: System.out.print("Quantity: "); int q2 = scan.nextInt...=(p2-(d2*p2))*q2; list.add(new Shop("Silk sari",q2,p2,d2,t2)); break; case 3
Use if, if else,for,while,do wile ad switch in same Java Class
: System.out.print("Quantity: "); int q2 = scan.nextInt(); System.out.print("Price: "); double p2 = scan.nextDouble(); double d2=0.30; double t2=(p2-(d2*p2))*q2; list.add
Java Showroom Application
; case 2: System.out.print("Quantity: "); int q2 = scan.nextInt... = 0.30; double t2 = (p2 - (d2 * p2)) * q2; list.add(new Shop("Silk sari", q2, p2, d2, t2)); break; case 3: System.out.print("Quantity
SHOPPING COUNTER
: System.out.print("Quantity: "); int q2 = scan.nextInt(); System.out.print("Price: "); double p2 = scan.nextDouble(); double t2=p2*q2; list.add(new Product("Garam
java multi - Java Beginners
of zeroâ??s present. Q.2. Write a program in java to input a sentence and find out
Relative listboxes in JSP - JSP-Servlet
and a readonly textbox with the total redeemed gift points 1) same qn like q2
Mouse Drag and Drop
, height;   int p1, q1, p2, q2;   ...;event.getX();   q2 = event.getY();   p = p + p2 - p1;   q = q + q2 
ARRAY TUTORIAL
ARRAY TUTORIAL  PLEASE HELP ME ANSWER THESE ARRAY TUTORIAL Q1- It is easy to write outsides the bounds of a String or an array in Java: True or False? If false, explain why. Q2 - In Java, you must declare an array before you
ARRAY TUTORIAL
ARRAY TUTORIAL  PLEASE HELP ME ANSWER THESE ARRAY TUTORIAL Q1- It is easy to write outsides the bounds of a String or an array in Java: True or False? If false, explain why. Q2 - In Java, you must declare an array before you
Product Register System using Java
: System.out.print("Quantity: "); int q2 = ...;scan.nextDouble(); double d2=0.05; double t2=(p2-(d2*p2))*q2
Calculate Company's Sale using Java
(); System.out.print("Quantity: "); int q2 = scan.nextInt... * q2; l2.add(t2); sum2 += t2; } p21=Double.parseDouble
PHP - WebSevices
as $key){ $q2 = "INSERT INTO `$element_history` (`$name_field`,user,time,action) VALUES ('$key','$username',$time,'$action')"; if(mysql_query($q2
Class SALE - Java Beginners
("Item Name:"); String name2=scan.next(); System.out.print("Quantity"); int q2... t2=p2*q2; l2.add(t2); sum2+=t2; } p21=Double.parseDouble((l2.get(0
Java - Development process
Java  Q 1- write a program in java to generate Armstrong numbers up to a specific limit? Q2- write a program in java to check a given number for Fibonacci term? Q3- write a program in java to generate prime number up
java - Java Beginners
java  Q 1- write a program in java to generate Armstrong numbers up to a specific limit? Q2- write a program in java to check a given number for Fibonacci term? Q3- write a program in java to generate prime number up
write following program
write following program  Q1 What is the difference between single threaded application and multithreaded application? What are the benefits of multi-threading. Explain with examples Q2 Write a java applet that takes your name
Cash Register System - Java Beginners
: "); int q2 = scan.nextInt(); System.out.print("Price: "); double p2 = scan.nextDouble(); double d2=0.05; double t2=(p2-(d2*p2))*q2; list.add(new Student("Water
java - Java Beginners
an overloaded method to calculate the area and output the value on the screen. Q.2.
java programming - Development process
java programming  Q 1- write a program in java to generate Armstrong numbers up to a specific limit? Q2- write a program in java to check a given number for Fibonacci term? Q3- write a program in java to generate prime
Design patterns interview questions1
becomes a design pattern. Q2. Can we always apply the same solution to different
QUE 50 ...please show output also...
QUE 50 ...please show output also...  Q1. Write a program to find maximum and minimum of 3 integers using nested if-else. Read numbers as a command line argument. Q2. Write a program that prints the prime no between 0

Ask Questions?

If you are facing any programming issue, such as compilation errors or not able to find the code you are looking for.

Ask your questions, our development team will try to give answers to your questions.