If you have an upgrade version of Windows 98, or the retail packaged
full install version (package and disk reads "for computers without
Windows); and if your hardware is adequate to meet the increased
requirements of Windows 98 then yes you can.
Windows 98 requires a faster CPU, more RAM, and more hard disk space
to install than Windows 95.
If you have an OEM version of Windows 98 (comes in a shrink-wrapped
package rather than a Microsoft retail box, and the CD reads "for sale
or distribution only with a new computer") then it almost certainly
will not do an upgrade install. You would have to reformat the hard
drive and then install the OEM Windows 98 on the empty drive.