|
understood.
No, I thought that if \t is used for tab character(which is a whitespace character), then this sort of symbol might be for space character too.
That's why I asked.
thanks,
|
|
|
|
|
|
|
Get Frhed.
You can download it here:
Frhed - Free hex editor[^]
There's so much going on with character encodings in developing software apps on all platforms that having a handy hex editor at you're disposal, especially if you're confused about which way something is going ... is a really good idea.
|
|
|
|
|
There's also the Hex Editor plugin[^] for VSCode[^], in case you need a non-Windows solution, or already have VSCode installed and don't want to install yet another editor.
"These people looked deep within my soul and assigned me a number based on the order in which I joined."
- Homer
|
|
|
|
|
In the noted line i have problem.where i am doing error so that i am not getting old address and new address? Rest of the things are showing expected result.
-----------------------------------
public void displayCustomerDetails(Address address) {
System.out.println("Displaying customer details \n***************************");
System.out.println("Customer Id : " + customerId);
System.out.println("Customer Name : " + customerName);
System.out.println("Contact Number :"+ contactNumber);
System.out.println("Customer Address : " +this.getAddress());
System.out.println();
}
public void updateDetails(Address address) {
System.out.println("Updating customer address...");
this.setAddress(address);
System.out.println("New Customer Address :"+ " "+this.getAddress() );
}
My Code
--------------
Customer Class
----------------------
public class Customer {
private String customerId;
private String customerName;
private long contactNumber;
private Address address;
public Customer(String customerId, String customerName, long contactNumber, Address address) {
this.customerId = customerId;
this.customerName = customerName;
this.contactNumber = contactNumber;
this.address = address;
}
public String getCustomerId() {
return customerId;
}
public String getCustonerId() {
return customerId;
}
public String getCustomerName() {
return customerName;
}
public void setCustomerName(String customerName) {
this.customerName = customerName;
}
public long getContactNumber() {
return contactNumber;
}
public void setContactNumber(long contactNumber) {
this.contactNumber = contactNumber;
}
public Address getAddress() {
return address;
}
public void setAddress(Address address) {
this.address = address;
}
public void displayCustomerDetails(Address address) {
System.out.println("Displaying customer details \n***************************");
System.out.println("Customer Id : " + customerId);
System.out.println("Customer Name : " + customerName);
System.out.println("Contact Number :"+ contactNumber);
System.out.println("Customer Address : " +this.getAddress());
System.out.println();
}
public void updateDetails(long mobile) {
System.out.println("Updating customer contact number...");
this.setContactNumber(mobile);
System.out.println("New Contact Number:"+ " "+this.getContactNumber());
}
public void updateDetails(Address address) {
System.out.println("Updating customer address...");
this.setAddress(address);
System.out.println("New Customer Address :"+ " "+this.getAddress() );
}
}
Address Class
----------------------------
public class Address {
public String homeNo;
private String street;
private String city;
private int pin;
public Address(String homeNo, String street, String city, int pin) {
this.homeNo = homeNo;
this.street = street;
this.city = city;
this.pin = pin;
}
public String getHomeNo() {
return homeNo;
}
public String getStreet() {
return street;
}
public String getCity() {
return city;
}
public int getPin() {
return pin;
}
}
Tester Class
---------------------------------
public class Tester {
public static void main(String[] args) {
Address custAddress = new Address("D109", "Castle Street", "London", 65436);
Customer customer = new Customer("C1016", "Stephen Abram", 7856341287L,custAddress);
customer.displayCustomerDetails(custAddress );
Address newAddress = new Address("D119"," St. Louis Street", "Springfield", 62729);
Long newContact = 7890098656L;
customer.updateDetails(newContact);
customer.updateDetails(newAddress);
}
}
output
--------------
Displaying customer details
***************************
Customer Id : C1016
Customer Name : Stephen Abram
Contact Number :7856341287
Customer Address : Demo1.Address@123a439b // see here it is not printing actual old address:confused:
Updating customer contact number...
New Contact Number: 7890098656
Updating customer address...
New Customer Address : Demo1.Address@7de26db8 // see it is not printing new address :confused:
modified 3-Mar-22 12:09pm.
|
|
|
|
|
|
I have to print old and new address. where my code is wrong?
|
|
|
|
|
You need to provide more details of where you are trying to print these details and what happens. Please edit your original post and add the requested information.
|
|
|
|
|
I have edited. please see where i am doing wrong?
|
|
|
|
|
In the following lines you have calls to getAddress() ...
System.out.println("Customer Address : " +this.getAddress());
System.out.println("New Customer Address :"+ " "+this.getAddress() );
... But that call returns the Customer.Address object which contains various properties. So when you pass that to the println method the system tries to print it. But since it has no idea how to print an Address object it just prints the class name and its memory address. You need to add a toString method to your Address class that returns the address formatted as a string.
|
|
|
|
|
so, we cannot print by just passing values to object of Address class. we must have to use setter method in Address class or toString method. right?
|
|
|
|
|
You should always add a toString method to your classes. All classes are ultimately based on the Object class, which has a very simple toString method (as you have seen). So unless you provide a custom version that is what you will get for your own classes. Remember, the Java system cannot guess what properties, or in what format, you want your classes to be printed.
|
|
|
|
|
got it. thanx 
|
|
|
|
|
public void displayCustomerDetails(Address address) {
System.out.println("Displaying customer details \n***************************");
System.out.println("Customer Obj: " + this);
System.out.println("Customer Id : " + customerId);
If you add the line above you will see something like:
Customer@4645
Another approach would be to add a printDetails() method to the Address class and then you could call
… getAddress().printDetails() …
|
|
|
|
|
Solve this question using java programming
Food Festival at HillTown
HillTown Inn is planning to organize a Food Festival bringing together at one place, a wide variety of cuisines from across the world on account of Christmas. The Hotel Management has rented out a square hall of an indoor Auditorium for this extravaganza. The side of the square hall is y inches in which a large square table is placed for the display of the most popular and celebrated food items. The side of the square table is x inches, such that x
|
|
|
|
|
While we are more than willing to help those that are stuck, that doesn't mean that we are here to do it all for you! We can't do all the work, you are either getting paid for this, or it's part of your grades and it wouldn't be at all fair for us to do it all for you.
So we need you to do the work, and we will help you when you get stuck. That doesn't mean we will give you a step by step solution you can hand in!
Start by explaining where you are at the moment, and what the next step in the process is. Then tell us what you have tried to get that next step working, and what happened when you did.
If you are having problems getting started at all, then this may help: How to Write Code to Solve a Problem, A Beginner's Guide[^]
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
And if you're going to post the homework assignment at least post ALL of it. Some of us have completion issues.
I’ve given up trying to be calm. However, I am open to feeling slightly less agitated.
|
|
|
|
|
i want to learn java, can anyone suggest me
https://myfiosgateway.one/ https://tutuappvip.co/mobdro-download
modified 6-Jun-22 5:33am.
|
|
|
|
|
A course is best - if you don't understand something, then a human can rephrase and try explaining a different way. Do the homework yourself as you learn best by doing, not copy'n'pasting!
The next best is a book: they deal with the material in a structured way, introducing all the language and framework elements in a way so they build on each other. Do all the tests and exercises as you go along - that helps to reinforce what you are learning. Wrox, Addison Wesley, and Microsoft Press all do good ones.
From here on down, it's generally poor: grabbing a compiler and trying things is a really bad way to learn anything useful, but is much better than watching YouTube tutorials - most of which are created by people who don't know how to make a video, don't know how to teach, and more often than not can't code either. Remember that "Likes" and "Subscribes" are currency: they make money so you get a lot of real crap there. There are good ones I'm sure, but they are so swamped under a massive pile of money-making rubbish that they are pretty much impossible to find.
Good luck - but don't expect to become an expert overnight - there is no short cut here!
"I have no idea what I did, but I'm taking full credit for it." - ThisOldTony
"Common sense is so rare these days, it should be classified as a super power" - Random T-shirt
AntiTwitter: @DalekDave is now a follower!
|
|
|
|
|
I am doing an assignment for college and have been stuck on a problem for the last 2 days... all articles and forums have led me down a road of despair. I created a javabean and jsp, but when I run it on Tomcat, I get an error that the class cannot be found. What should be so simple is such a pain in my ___. For the love of God please someone help me haha!
*** I am running on TomCat v10 / Eclipse and have also tried just placing the files inside the TomCat dir; .jsp in ROOT and .java in WEB-INF/classes/ ***
>>> ImpDateBean.jsp <<<
<%@ page language="java" contentType="text/html; charset=ISO-8859-1"
pageEncoding="ISO-8859-1"%>
<%@ page import="javabean.CurrentDate"%>
<!DOCTYPE html>
<html>
<head>
<meta charset="ISO-8859-1">
<title>JavaBean Training</title>
</head>
<body>
<jsp:useBean id="Date" class="javabean.CurrentDate" scope="session">
<jsp:setProperty name="Date" property="*" />
</jsp:useBean>
<p>
Today's date is: <br>
<jsp:getProperty name="Date" property="date_today" />
</p>
</body>
</html>
>>> CurrentDate.java <<<
package javabean;
import java.io.Serializable;
import java.util.Date;
public class CurrentDate implements Serializable {
private Date date_today = new Date();
private static final long serialVersionUID = 1L;
public CurrentDate() {}
public CurrentDate(Date date_today) {
this.date_today = date_today;
}
public Date getDay() {
return date_today;
}
public void setDay(Date date_today) {
this.date_today = date_today;
}
}
Thank you!
-Josh
|
|
|
|
|

Type Exception Report
Message /ImpDateBean.jsp (line: [11], column: [2]) The value for the useBean class attribute [javabean.CurrentDate] is invalid.
Description The server encountered an unexpected condition that prevented it from fulfilling the request.
Exception
org.apache.jasper.JasperException: /ImpDateBean.jsp (line: [11], column: [2]) The value for the useBean class attribute [javabean.CurrentDate] is invalid.
org.apache.jasper.compiler.DefaultErrorHandler.jspError(DefaultErrorHandler.java:41)
org.apache.jasper.compiler.ErrorDispatcher.dispatch(ErrorDispatcher.java:292)
org.apache.jasper.compiler.ErrorDispatcher.jspError(ErrorDispatcher.java:115)
org.apache.jasper.compiler.Generator$GenerateVisitor.visit(Generator.java:1373)
org.apache.jasper.compiler.Node$UseBean.accept(Node.java:1189)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2387)
org.apache.jasper.compiler.Node$Visitor.visitBody(Node.java:2439)
org.apache.jasper.compiler.Node$Visitor.visit(Node.java:2445)
org.apache.jasper.compiler.Node$Root.accept(Node.java:473)
org.apache.jasper.compiler.Node$Nodes.visit(Node.java:2387)
org.apache.jasper.compiler.Generator.generate(Generator.java:3609)
org.apache.jasper.compiler.Compiler.generateJava(Compiler.java:257)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:391)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:367)
org.apache.jasper.compiler.Compiler.compile(Compiler.java:351)
org.apache.jasper.JspCompilationContext.compile(JspCompilationContext.java:603)
org.apache.jasper.servlet.JspServletWrapper.service(JspServletWrapper.java:399)
org.apache.jasper.servlet.JspServlet.serviceJspFile(JspServlet.java:380)
org.apache.jasper.servlet.JspServlet.service(JspServlet.java:328)
jakarta.servlet.http.HttpServlet.service(HttpServlet.java:777)
org.apache.tomcat.websocket.server.WsFilter.doFilter(WsFilter.java:53)
|
|
|
|
|
It is a long time since I worked with JSP, but I recall the bean classes had to be stored in the correct location of the web folders. Where is your class file stored in the server? Please show the complete structure.
|
|
|
|
|
You put .class files in the classes folder.
javac your Java file?
Make sure you keep the .class file in its javabean package folder.
../classes/javabean/CurrentDate.class
|
|
|
|
|
Josh Hebert wrote: package javabean;
import java.io.Serializable;
import java.util.Date;
public class CurrentDate implements Serializable {
Can't say what the root directory should be but you must have the following path under that root.
.\javabean\CurrentDate.class
|
|
|
|